Intermediate

Container Security Basics

Harden a container image end-to-end: choose a trustworthy minimal base, run as a non-root user, scan for known vulnerabilities with Docker Scout and Trivy, and keep secrets out of image layers.

~3h
0 / 7 steps
🚀
Intro

What you're building

Prerequisites: Completion of Dockerfile Fundamentals and Multi-Stage Builds; a Docker Hub account for docker scout; Trivy installed locally as a second scanner (optional but recommended).

Targeted versions: Docker Scout CLI (bundled with Docker Desktop 4.17+); Trivy (open-source, Aqua Security); Docker Engine 29.x with BuildKit; verified against docs.docker.com and github.com/aquasecurity/trivy, mid-2026.

A working Dockerfile isn't automatically a safe one. In this project you'll take an image you've already built in this roadmap and put it through the same hardening pass a security-conscious team would: trusted base image, least-privilege user, vulnerability scanning, and no leaked secrets in the final layers.

🔨

Pick a trustworthy, minimal base

🔨

Run as a non-root user

🔨

Scan for vulnerabilities

🔨

Keep secrets out of image layers

🎯
Secret Mission

Secret Mission: gate a build on scan results

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock