1. Images & Charts
  2. go
go

go

Dev
Updated 17 hours ago

Go Overview

Secure your stack with a hardened Go image freshly-built by Minimus. Minimus images always include the most up-to-date package version for all packages and dependencies contained in the image.


Use this image to compile your Go project to build the most secure, vulnerability-free application possible. Go is not a runtime image, so it's best to use a multi-stage build and run the binary on another minimal runtime base image, either static or glibc-dynamic. Learn how it's done


Try It Out

To take the Minimus Go image for a test run, we will need a simple Go script and a Dockerfile to build our Go app.

In your project directory, save the code below to a Dockerfile:

FROM reg.mini.dev/go:latest

# Set the CGO_ENABLED to 0 for static compilation
ENV CGO_ENABLED=0

# set working directory inside the container 
WORKDIR /app

# copy the Go source code
COPY Hello-Minimus.go .

# compile the application with CGO disabled
RUN go build -o hello Hello-Minimus.go

# set default command to run when the container starts
CMD ["./hello"]

In the same directory, create a simple Go script. Save the code below to a file and name it Hello-Minimus.go:

package main

import "fmt"

func main() {
    fmt.Println("Hello from Minimus!")
}

Third, create a go.mod file. It defines the modules for your Go project and handles dependencies. In our case, it's very simple:

module minimus.dev/hello_minimus

go 1.25

Your project directory should now look like this:

project-root/
├── Dockerfile
├── Hello-Minimus.go
└── go.mod

Next, build and run your custom image. Note that the period . specifies the current directory as the build context:

docker build -t minimus-go .
docker run minimus-go

You should get a Minimus greeting.


Technical Considerations

The Go image provided by Minimus is a slim, security-hardened alternative to the public image from Docker Hub. The images are largely interchangeable, with a few differences as noted below.

Go built by Minimus:

  1. Runs as root to support required functions. The public image also runs as root.

  2. Drill down on the version specification tab to see the default user, listening ports, entrypoint, volumes, environment variables, etc.

  3. Enables the GODEBUG environment variable by default. You can disable it by setting: tarinsecurepath=1 and zipinsecurepath=1.

The Payoff

A hardened, minimal image that will remain more secure for the long run and accrue vulnerabilities at a slower rate.


Terms & Info

Trademark

This catalog is published by Minimus. All product names, logos, and marks, other than those belonging to Minimus, shown are owned by their respective rights holders and appear here only to identify the open source software each image contains. Minimus claims no ownership of those marks and implies no affiliation with, endorsement by, certification by, or sponsorship by any rights holder.

Disclaimer

Images are provided "as-is" without warranty of any kind. "Hardened" refers to the security configuration applied at the time of build and does not constitute a guarantee of ongoing security or absence of vulnerabilities. The free tier is provided without support, SLA, or guaranteed patching timelines. Security updates may be applied to paid subscriptions before or instead of free tier images. By pulling or using any image you agree to our Terms of Use.