ContainersDocker
Distroless and minimal base images
A minimal base image contains the application's runtime dependencies and little else. The smallest ones have no shell and no package manager, which changes how you build the image and how you debug the container.

Distroless images
A distroless image holds your application, the runtime dependencies it needs and nothing else. Package managers, shells and the other programs of a standard Linux distribution are absent. The project publishes them under gcr.io/distroless, based on Debian 13:
static-debian13contains CA certificates, an/etc/passwdentry for a root user, a/tmpdirectory and tzdata. It is for statically compiled applications that do not require libc.base-nossl-debian13adds glibc.base-debian13adds glibc and libssl.cc-debian13adds libgcc1 and its dependencies to the base image.java17-debian13,java21-debian13,java25-debian13,nodejs22-debian13,nodejs24-debian13,nodejs26-debian13andpython3-debian13include a language runtime.
Each image has the tags latest, nonroot, debug and debug-nonroot. The README says any other tags are deprecated and no longer updated. Write the -debian13 suffix explicitly: a name with no suffix selects -debian13 today and will change to a newer Debian version.
This is the README's Go example, with the Go version it uses:
# Start by building the application.
FROM golang:1.18 as build
WORKDIR /go/src/app
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 go build -o /go/bin/app
# Now copy it into our base image.
FROM gcr.io/distroless/static-debian13
COPY --from=build /go/bin/app /
CMD ["/app"]With no shell in the image, an ENTRYPOINT must be written in vector form, as in ENTRYPOINT ["myapp"]. All distroless images are signed with cosign, and the README recommends verifying an image before you build on it:
cosign verify $IMAGE_NAME \
--certificate-oidc-issuer https://accounts.google.com \
--certificate-identity [email protected]Alpine and its musl caveat
Alpine Linux is a distribution built around musl libc and BusyBox, with its own package manager, apk. Docker's description of the official image gives its size as 5 MB. Alpine's own site says a container requires no more than 8 MB.
The caveat is in the Docker Official Images note for Alpine-based variants. These images use musl libc in place of glibc, and the note says software runs into issues depending on the depth of its libc requirements or assumptions. Test your application on Alpine before you choose it.
scratch for static binaries
scratch is a reserved, minimal image, a starting point for building containers. You cannot pull it, run it or tag an image with that name. In a Dockerfile, FROM scratch signals that the next command is the first filesystem layer of your image. Docker's example:
# syntax=docker/dockerfile:1
FROM scratch
ADD hello /
CMD ["/hello"]The example runs only as long as the hello binary has no runtime dependencies. Docker's page names three kinds of dependency: programming language runtimes, dynamically linked C libraries and CA certificates.
Other hardened image lines
- Docker Hardened Images are minimal images maintained by Docker. Its documentation lists distroless variants, non-root execution by default, images built on Alpine and Debian with musl and glibc variants, and signed SBOMs, provenance and VEX statements on every image. There is a free Community tier, and Select and Enterprise subscriptions.
- Chainguard Containers are built with Chainguard OS and are available from the Chainguard registry. Many of the images are distroless, and
-devvariants add a shell and tools such as a package manager. The Free images are limited to thelatestandlatest-devtags. Production containers are the paid tier.
Debugging with no shell
The Kubernetes documentation shows what happens with an image that has no shell: kubectl exec -it ephemeral-demo -- sh fails with executable file not found in $PATH. Its answer is an ephemeral container:
kubectl debug -it ephemeral-demo --image=busybox:1.28 --target=ephemeral-demoephemeral-demo is the pod and container name in that example. The command adds a busybox container to the pod and attaches to it, and --target targets the process namespace of another container. The container runtime must support --target.
The pods/ephemeralcontainers subresource is not part of the default admin and edit ClusterRoles, so a cluster administrator has to grant it.
For distroless, the debug tags provide a busybox shell. The README builds an image on a :debug tag and enters it with docker run --entrypoint=sh -ti my_debug_image.
What a CVE count leaves out
Four documented facts to read next to a scanner's count:
- What the scanner covers. Trivy's documentation says its OS package scanning does not support third-party or self-compiled packages and binaries, only official packages provided by vendors such as Red Hat and Debian. Language-specific packages are a separate entry in its list.
- How long the image is maintained. Distroless tracks Debian's standard support timeline and publishes an estimated end of life per image.
- When you last rebuilt. Docker's best-practices page describes an image as a snapshot taken at build time and tells you to rebuild regularly with updated dependencies.
- What the publisher states. The distroless README says a minimal image improves the signal to noise of scanners. Chainguard says its images are rebuilt nightly. Docker lists near-zero CVEs and VEX statements for its hardened images.
How to choose
- For a statically compiled application that does not require libc, use
static-debian13, orscratchif the binary has no runtime dependencies. - For an application that requires libc, use
base-debian13. - For Java, Node.js or Python, use the distroless image that includes the runtime.
- If you choose Alpine, test against musl first.
- If you need FIPS variants or a patching SLA, the Docker and Chainguard documentation list both in their paid tiers.
Whichever you pick, try kubectl debug before you need it.
Sources
Want a second pair of eyes on yours? We do this work for a living.
More guides

Debug a running pod with kubectl debug
Kubernetes · 4 min read
Ephemeral containers, pod copies, node shells and debug profiles, with the commands for each.

Scan container images with Trivy in CI
Supply chain · 4 min read
The flags, the ignore file, the pinned action and the limits of scanning an image with Trivy.

Multi-stage Dockerfiles: smaller images with less to patch
Containers · 4 min read
Build in one stage, ship from another, and leave the build tools behind.