Skip to main content

Security Hardening

Container security is about reducing the blast radius if an application is compromised. Docker containers share the host kernel, so without hardening an attacker who escapes a container gains access to everything.

Defense in Depth

What You Will Learn

LessonWhat It Covers
Container Security BasicsNon-root users, capabilities, read-only filesystems
Image SecurityMinimal base images, vulnerability scanning, digest pinning
Secrets ManagementFile-based secrets, environment variable risks, Compose secrets
Security Audit ChecklistActionable pre-deployment security review

The Golden Rule

Every container should run with the minimum privileges needed to function. If it does not need root, do not give it root. If it does not need a capability, drop it.

Prerequisites

  • Understand Dockerfiles and image building (Module 3)
  • Understand Docker Compose (Module 7)