|
| 1 | +--- |
| 2 | +title: How Docker Hardened Images are built |
| 3 | +linkTitle: Build process |
| 4 | +description: Learn how Docker builds, tests, and maintains Docker Hardened Images through an automated, security-focused pipeline. |
| 5 | +keywords: docker hardened images, slsa build level 3, automated patching, ai guardrail, build process, signed sbom, supply chain security |
| 6 | +weight: 15 |
| 7 | +--- |
| 8 | + |
| 9 | +Docker Hardened Images are built through an automated pipeline that monitors |
| 10 | +upstream sources, applies security updates, and publishes signed artifacts. |
| 11 | +This page explains the build process for both DHI images and customized |
| 12 | +images built from them. |
| 13 | + |
| 14 | +## Build triggers |
| 15 | + |
| 16 | +Builds start automatically. You don't trigger them manually. The system monitors |
| 17 | +for changes and starts builds in two scenarios: |
| 18 | + |
| 19 | +- [Upstream updates](#upstream-updates) |
| 20 | +- [Customization changes](#customization-changes) |
| 21 | + |
| 22 | +### Upstream updates |
| 23 | + |
| 24 | +New releases, package updates, or CVE fixes from upstream projects trigger base |
| 25 | +image rebuilds. These builds go through quality checks to ensure security and |
| 26 | +reliability. |
| 27 | + |
| 28 | +#### Monitoring for updates |
| 29 | + |
| 30 | +Docker continuously monitors upstream projects for new releases, package |
| 31 | +updates, and security advisories. When changes are detected, the system |
| 32 | +automatically queues affected images for rebuild using a SLSA Build Level |
| 33 | +3-compliant build system. |
| 34 | + |
| 35 | +Docker uses three strategies to track updates: |
| 36 | + |
| 37 | +- GitHub releases: Monitors specific GitHub repositories for new releases and |
| 38 | + automatically updates the image definition when a new version is published. |
| 39 | +- GitHub tags: Tracks tags in GitHub repositories to detect new versions. |
| 40 | +- Package repositories: Monitors Alpine Linux, Debian, and Ubuntu package |
| 41 | + repositories through Docker Scout's package database to detect updated |
| 42 | + packages. |
| 43 | + |
| 44 | +In addition to explicit upstream tracking, Docker also monitors transitive |
| 45 | +dependencies. When a package update is detected (for example, a security patch |
| 46 | +for a library), Docker automatically identifies and rebuilds all images within |
| 47 | +the support window that use that package. |
| 48 | + |
| 49 | +### Customization changes |
| 50 | + |
| 51 | +Updates to your OCI artifact customizations trigger rebuilds of your customized |
| 52 | +images. |
| 53 | + |
| 54 | +When you customize a DHI image, your changes are packaged as OCI artifacts that |
| 55 | +layer on top of the base image. Docker monitors your artifact repositories and |
| 56 | +automatically rebuilds your customized images whenever you push updates. |
| 57 | + |
| 58 | +The rebuild process fetches the current base image, applies your OCI artifacts, |
| 59 | +signs the result, and publishes it automatically. You don't need to manage |
| 60 | +builds or maintain CI pipelines for your customized images. |
| 61 | + |
| 62 | +Customized images are also rebuilt automatically when the base DHI image they |
| 63 | +depend on receives updates, ensuring your images always include the latest |
| 64 | +security patches. |
| 65 | + |
| 66 | +## Build pipeline |
| 67 | + |
| 68 | +The following sections describe the build pipeline architecture and workflow for |
| 69 | +Docker Hardened Images based on: |
| 70 | + |
| 71 | +- [Base image pipeline](#base-image-pipeline) |
| 72 | +- [Customized image pipeline](#customized-image-pipeline) |
| 73 | + |
| 74 | +### Base image pipeline |
| 75 | + |
| 76 | +Each Docker Hardened Image is built through an automated pipeline: |
| 77 | + |
| 78 | +1. Monitoring: Docker monitors upstream sources for updates (new releases, |
| 79 | + package updates, security advisories). |
| 80 | +2. Rebuild trigger: When changes are detected, an automated rebuild starts. |
| 81 | +3. AI guardrail: An AI system fetches upstream diffs and scans them with |
| 82 | + language-aware checks. The guardrail focuses on high-leverage issues that can |
| 83 | + cause significant problems, such as inverted error checks, ignored failures, |
| 84 | + resource mishandling, or suspicious contributor activity. When it spots |
| 85 | + potential risks, it blocks the PR from auto-merging. |
| 86 | +4. Human review: If the AI identifies risks with high confidence, |
| 87 | + Docker engineers review the flagged code, reproduce the issue, and decide on |
| 88 | + the appropriate action. Engineers often contribute fixes back to upstream |
| 89 | + projects, improving the code for the entire community. When fixes are accepted |
| 90 | + upstream, the DHI build pipeline applies the patch immediately to protect |
| 91 | + customers while the fix moves through the upstream release process. |
| 92 | +5. Testing: Images undergo comprehensive testing for compatibility and |
| 93 | + functionality. |
| 94 | +6. Signing and attestations: Docker signs each image and generates |
| 95 | + attestations (SBOMs, VEX documents, build provenance). |
| 96 | +7. Publishing: The signed image and attestations are published to Docker Hub. |
| 97 | +8. Cascade rebuilds: If any customized images use this base, their rebuilds |
| 98 | + are automatically triggered. |
| 99 | + |
| 100 | +Docker responds quickly to critical vulnerabilities. By building essential |
| 101 | +components from source rather than waiting for packaged updates, Docker can |
| 102 | +patch Critical and High-severity CVEs within days of upstream fixes and publish |
| 103 | +updated images with new attestations. |
| 104 | + |
| 105 | +The following diagram shows the base image build flow: |
| 106 | + |
| 107 | +```goat {class="text-sm"} |
| 108 | +.-------------------. .-------------------. .-------------------. .-------------------. |
| 109 | +| Docker monitors |----->| Trigger rebuild |----->| AI guardrail |----->| Human review | |
| 110 | +| upstream sources | | | | scans changes | | | |
| 111 | +'-------------------' '-------------------' '-------------------' '-------------------' |
| 112 | + | |
| 113 | + v |
| 114 | +.-------------------. .-------------------. .-------------------. .-------------------. |
| 115 | +| Cascade rebuilds |<-----| Publish to |<-----| Sign & generate |<-----| Testing | |
| 116 | +| (if needed) | | Docker Hub | | attestations | | | |
| 117 | +'-------------------' '-------------------' '-------------------' '-------------------' |
| 118 | +``` |
| 119 | + |
| 120 | +### Customized image pipeline |
| 121 | + |
| 122 | +When you customize a DHI image, the build process is simplified: |
| 123 | + |
| 124 | +1. Monitoring: Docker monitors your OCI artifact repositories for changes. |
| 125 | +2. Rebuild trigger: When you push updates to your OCI artifacts, or when the base |
| 126 | + DHI image is updated, an automated rebuild starts. |
| 127 | +3. Fetch base image: The latest base DHI image is fetched. |
| 128 | +4. Apply customizations: Your OCI artifacts are applied to the base image. |
| 129 | +5. Signing and attestations: Docker signs the customized image and generates |
| 130 | + attestations (SBOMs, VEX documents, build provenance). |
| 131 | +6. Publishing: The signed customized image and attestations are published to |
| 132 | + Docker Hub. |
| 133 | + |
| 134 | +Docker handles the entire process automatically, so you don't need to manage |
| 135 | +builds for your customized images. However, you're responsible for testing your |
| 136 | +customized images and managing any CVEs introduced by your OCI artifacts. |
| 137 | + |
| 138 | +The following diagram shows the customized image build flow: |
| 139 | + |
| 140 | +```goat {class="text-sm"} |
| 141 | +.-------------------. .-------------------. .-------------------. |
| 142 | +| Docker monitors |----->| Trigger rebuild |----->| Fetch base | |
| 143 | +| OCI artifacts | | | | DHI image | |
| 144 | +'-------------------' '-------------------' '-------------------' |
| 145 | + | |
| 146 | + v |
| 147 | +.-------------------. .-------------------. .-------------------. |
| 148 | +| Publish to |<-----| Sign & generate |<-----| Apply | |
| 149 | +| Docker Hub | | attestations | | customizations | |
| 150 | +'-------------------' '-------------------' '-------------------' |
| 151 | +``` |
0 commit comments