What this thread does
Inspect the final image, remove build-only content and credentials, set a non-root user, and exercise the app under the runtime restrictions you will deploy.
Do first: Run docker image inspect app:review on your candidate image and inspect its configured user, environment, entrypoint and declared volumes. Is its user root/empty, and which paths does startup need to write? Use those findings to choose the branches below; replace app:review with your candidate tag. Image inspection.
As of November 2026. These branches target Docker Engine 29.9.3 with BuildKit 0.34.2, documented in the November 3, 2026 release notes. Check your client/server using docker version. Scout is a separate CLI prerequisite. This is a Linux application-image review; runtime flags are companion deployment settings, not properties baked into an image.
1. The final image defaults to root
For Engine 29.9.3, follow USER guidance: create the app identity with the base's tooling and set a numeric USER in the final stage, for example USER 10001:10001 if those IDs are reserved for the app. Give it only the required file access. Check: rebuild, inspect the configured user, confirm the running process is non-root, and exercise startup/requests/uploads without a --user override. Redesign root-dependent initialization first.
2. The final stage contains unused build tools
For Engine 29.9.3 / BuildKit 0.34.2, follow multi-stage builds: name the builder build, then use COPY --from=build ... for runtime outputs in a minimal compatible base. Preserve required native libraries and CA certificates. Pin a real base digest and refresh it deliberately. Check: compare package inventories and size, then run integration checks from the final stage. Review docker scout recommendations app:review for base updates.
3. Credentials enter through ARG, ENV or copied files
For BuildKit 0.34.2 on Engine 29.9.3, use the official build-secret mounts. Pass a credential file with docker build --secret id=repo,src=./build-secret.txt -t app:review .; the consuming Dockerfile instruction uses RUN --mount=type=secret,id=repo,target=/run/secrets/repo and your package client's file-based credential option in that same instruction. Exclude the credential file from the build context with .dockerignore. Ensure the client never copies it into outputs or prints it. Runtime secrets require runtime injection, separate from build mounts. Check: review final image configuration, history and layer contents for the credential material with a secret-aware scanner. Treat every image layer as part of the credential review. Rotate credentials already exposed in an image.
4. The app needs only bounded temporary writes
For Engine 29.9.3 Linux containers, follow the --read-only and --tmpfs reference. Start a candidate with:
docker run --name image-review --read-only \
--tmpfs /tmp:rw,noexec,nosuid,size=65536k \
--cap-drop ALL --security-opt no-new-privileges=true app:review
Exercise startup, a request and shutdown. For write failures, mount only the required cache path; persistent data needs an explicit volume with suitable ownership. Check docker container inspect image-review for the read-only root, mounts and restrictions, then repeat the app's smoke checks. noexec can break generated executables. Add only permissions/capabilities the app requires, and review declared image volumes: they remain separate writable locations.
5. The release image has no actionable vulnerability review
For the Engine 29.9.3 candidate, with Docker Scout installed, use docker scout cves: docker scout cves --only-severity critical,high --exit-code app:review. Exit 2 means vulnerabilities matched the filter. Inspect affected packages and fixed versions; use docker scout recommendations app:review for base-image options, rebuild and rescan. Check the image ID/digest so the scanned artifact is the one released; retain the report and resolve findings or record the reason for an exception. Review the full report too: a high/critical filter is one policy, not a complete risk assessment. A clean CVE result does not check embedded secrets or runtime permissions.
Evidence and limits
Markus Dahlmanns, Constantin Sander, Robin Decker and Klaus Wehrle's July 8, 2023 study found exposed secrets across a large image corpus, motivating layer-aware credential inspection rather than checking only the final visible filesystem. Docker's dated release notes establish the Engine/BuildKit scope; its build and CLI references define the settings above. These measures reduce image exposure but do not establish application correctness, host isolation or protection from unknown vulnerabilities. USER is distinct from running the Docker daemon rootless, and an image cannot enforce --read-only by itself.
Not for: Podman, Windows containers, Kubernetes pod/cluster hardening or Docker daemon/rootless setup. Not for: Compose app/database readiness, see case-docker-compose-app-and-database-readiness-ports-memory-env; image size alone, see python-docker-image-gigabytes-multistage-slim-uv; an isolated private-download credential question, see docker-build-needs-a-private-download-without-keeping-its; an existing bind-mount permission error, see docker-bind-mount-permission-denied-or-root-owned-files-on-host.
Started from a post by @Docker, packaged by the editor. Original post