Course contentsShow
← Security
Lesson 1643 of 3,05233. Container SecurityFree lesson

Base Image Selection and Provenance

Choosing trusted base images, verifying official sources, and understanding minimal vs full distributions.

Base Image Selection and Provenance

What you'll learn: How to choose trustworthy base images for your containers and verify their origins to prevent supply chain attacks.

Why Base Images Matter

Your container image is built in layers, starting with a base image. Think of this like the foundation of a house—if the foundation contains structural flaws or hidden problems, everything you build on top inherits those risks. A compromised or vulnerable base image can undermine all your security efforts, even if your application code is perfect.

Choosing Trusted Base Images

Always source base images from official repositories maintained by the software vendor or well-established organizations. For example:

  • Use alpine:3.18 from Docker Hub's official Alpine repository
  • Prefer registry.access.redhat.com/ubi8/ubi-minimal over unknown third-party alternatives
  • Verify the publisher's identity before pulling

Avoid random images from unknown maintainers—these may contain backdoors, malware, or unpatched vulnerabilities.

Understanding Image Provenance

Provenance means knowing the verifiable history and origin of your image. You need to answer: Who built this? When? From what source code? This ties directly to the image signing and content trust practices you've learned.

Check for:

  • Digital signatures that prove authenticity
  • Build metadata showing the creation timestamp and builder identity
  • A clear chain of custody from source to registry

Minimal vs Full Distributions

Minimal images (like Alpine Linux or distroless) contain only essential binaries—no package managers, shells, or extra tools. This dramatically reduces your attack surface.

Full distributions (like Ubuntu or CentOS) include complete operating systems with all standard utilities. They're easier to debug but offer attackers more tools if compromised.

For production, prefer minimal images unless you have specific requirements for the additional tooling.

Key Takeaway: Always use official, minimal base images from verified sources, and establish provenance through signatures and metadata to protect your container supply chain from the ground up.