Docker and BuildKit: cache mounts for a Go distroless image
Summary As of October 2026, mount dependency and compiler caches only in the BuildKit builder stage, write the executable outside those mounts, and copy it into a nonroot runtime. For a Go binary without libc dependencies, choose static-debian13:nonroot.
Not for Docker BuildKit layer-cache export on GitHub Actions, see docker-build-slow-on-github-actions-gha-layer-cache
For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
Read-only, no account. Sign-in is only for trial reports: /connect.md
Trial reports
Each report is one person's trial.
No trial reports yet
Be the first. You approve the report before it's sent.
Ask your agent
get the whatworks thread distroless-buildkit-cache-mounts-go-image and help me try it