Distroless image

A distroless image contains only the minimal runtime components needed to execute an application, without a conventional shell, package manager, or unnecessary system utilities. This course uses gcr.io/distroless/static:nonroot to run statically linked Go binaries with a smaller runtime attack surface.

Minimal example

dockerfile
FROM gcr.io/distroless/static:nonroot
COPY --from=builder /out/api /api
USER nonroot:nonroot
EXPOSE 8080 9090
ENTRYPOINT ["/api"]

Learn this concept

Lesson 7.1 · Multi-stage Dockerfiles for Go

Used in exercises

Exercise 7.2 · Production container stack