Production containers
Small images, least privilege and scanning reduce the blast radius.
What you will be able to do
- Use a distroless or Alpine runtime and pin versions.
- Set --read-only, --cap-drop ALL and a non-root user where supported.
- Scan images in CI and rebuild base images on a schedule.
In plain English
Production containers should run as non-root, read-only where possible and with a minimal image. Do not mount the Docker socket into an application. Scan images for known vulnerabilities and set resource limits.
docker run --rm \
--read-only \
--cap-drop ALL \
--security-opt no-new-privileges \
--memory 256m \
--publish 3000:3000 \
my-app:1.0Your turn
MediumHarden a run command
Run an app read-only with all capabilities dropped and no-new-privileges.
BASH · starter
docker run my-app:1.0Check your understanding before moving on.
Knowledge checkQuestion 1
Why avoid mounting /var/run/docker.sock into an app container?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.