Skip to main content

Security for Dockers

Docker security is the set of habits that limit damage if a container or image is compromised. It includes running as a non-root user, dropping Linux capabilities, using a read-only filesystem, scanning images for known vulnerabilities and pulling from trusted, signed registries.

Stage: Compose and Security · Part of the Docker roadmap · Last reviewed 19 November 2026

What to learn in Security

Security interview questions

Why should containers not run as root?

Root inside a container is still root with respect to many kernel interfaces, so a breakout or a mounted host path becomes far more dangerous. Running as an unprivileged user limits what a compromised process can read, write or change.

Why is baking an API key into an image with ENV a mistake?

Anyone who can pull the image can read the value from the layers and from docker history, even if a later step removes it. Secrets should be injected at runtime through secrets or the orchestrator, and rotated if they ever leaked.

Where Security fits in the Docker roadmap

Security belongs to the Compose and Security stage (intermediate level), which takes about 12 hours. Real stacks.

Back to the full Docker roadmap