Non-root container

A non-root container runs its application process as a user other than root inside the container. In this course, the distroless nonroot image and USER nonroot:nonroot instruction limit the privileges available to the Go API and worker processes.

Minimal example

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

Learn this concept

Lesson 7.1 · Multi-stage Dockerfiles for Go

Used in exercises

Exercise 7.2 · Production container stack
Prerequisite conceptsDistroless image