Lesson 3 of 3 AMIs and EC2 Image Builder

Governing Container Base Images

This lesson explains how operations teams govern container base images, their vulnerabilities and their distribution, although application images are usually built in CI/CD systems.

Learning outcomes

After completing this lesson, you will be able to:

  • Build base images with container recipes.
  • Apply golden base image practices.
  • Choose where images are built.

Container recipes

An Image Builder container recipe starts from a base image (for example from ECR Public or Docker Hub), applies components defined as Dockerfile-style instructions and Image Builder components, and pushes the result to an ECR repository named in the distribution configuration, including repositories in other Regions. This lets a platform team publish hardened, regularly patched base images that application teams build on, with Inspector findings for each version.

The following diagram shows a container recipe from base image to ECR.

A hardened base image built with an Image Builder container recipe. The recipe starts from a base image, applies Dockerfile-style instructions and components, and pushes the result to ECR repositories named in the distribution configuration, including other Regions, where Inspector reports findings for each version.
The Regions are illustrative.

Golden base image practices

A golden base image is the approved starting point on which all application images are built. Because every application inherits its packages, a vulnerability in the base image appears in every service, and a fix in the base image reaches every service at its next build. Base images therefore need the same governance as AMIs: minimal content, regular rebuilding, scanning and controlled distribution. The following practices keep container base images secure and manageable.

  • Use minimal base images to reduce the attack surface and scan findings.
  • Rebuild base images on a schedule so OS packages receive patches, even if the application has not changed.
  • Use immutable tags and digests in task definitions and Kubernetes manifests.
  • Enable ECR enhanced scanning and block deployment of images with critical findings.
  • Expire old images with ECR lifecycle policies.

Choosing where images are built

Two places commonly build container images, and they serve different layers. Image Builder container recipes suit base images owned by a platform or operations team: they run on a schedule or when a dependency changes, apply the same hardening components that are used for AMIs, and distribute the result to repositories in several Regions and accounts. Application images, which change with every code commit, are usually built in the application's CI system, such as AWS CodeBuild, starting FROM the approved base image.

This division gives each team clear ownership. When a new vulnerability is published, the platform team rebuilds the base image once, and application teams pick it up on their next build; ECR enhanced scanning shows which application images still contain the vulnerable package. The following table compares the two build locations.

Image Builder container recipe
Typical ownerPlatform or operations team
TriggerSchedule or base image update
ContentOS packages, agents, hardening
DistributionECR repositories in several Regions and accounts
Application CI build
Typical ownerApplication team
TriggerCode commit
ContentApplication code and dependencies
DistributionThe application's repository
Sort into groups

Image Builder or the CI pipeline?

Exam skills 3.1.1

Decide where each kind of image should be built.

Log in to try this activity Interactive activities are free with an account.
Worked example

A patched base image

Inspector reports a critical vulnerability in OpenSSL in hundreds of container images, all built from the same base image. The platform team's Image Builder container pipeline is triggered manually, applies the updated packages and pushes base/python:3.12-2026.10.15 to ECR in both Regions. Application pipelines rebuild on the new base image, and Inspector closes the findings as the vulnerable images stop running and are expired by lifecycle policies.

Check yourself

Where do container recipes push the images they build?

Show answer

To Amazon ECR.

Exam Tips

Remember for the exam

  • Container recipes build Docker images and push them to ECR.
  • Rebuild base images regularly to pick up OS patches.
  • Pair Image Builder with ECR enhanced scanning and lifecycle policies.