Docker & ContainersXXX Β· Host MaintenancePatching
Host patching strategy β what a Docker host needs and how often
What you'll learn
- Identify which host packages affect running containers and which do not
- Configure unattended-upgrades so it cannot restart the Docker daemon
- Separate the security patching cadence from the Docker upgrade cadence
- Audit what an automatic patch run would actually do before it runs
Prerequisites
Verified against Docker Engine 29.x Β· Docker Engine 28.x Β· Docker Compose 2.x Β· containerd 2.x Β· runc 1.2.x Β· BuildKit 0.20+ Β· Linux kernel 5.15+ Β· Ubuntu 24.04 LTS Β· Debian 12 (Bookworm) Β· 2026-08-11
A Docker host runs the same operating system as everything else you patch, and for most of its packages the usual rules apply: apply security updates promptly, automatically where you can.
Two things make it different. The docker-ce and containerd.io packages
restart services that every workload on the machine depends on, and the
container isolation model means several host libraries reach inside
containers in ways that are not obvious from the package list.
What reaches into a container
Containers share the host kernel and, for some subsystems, the hostβs policy configuration. A patch to any of these changes behaviour inside every container on the machine:
| Host component | How it reaches containers | Needs |
|---|---|---|
| Kernel | Shared by every container; namespaces, cgroups, overlayfs, seccomp are kernel features | Reboot |
libseccomp2 | The daemon uses it to compile the seccomp profile applied at container start | Daemon restart, then container recreation |
| AppArmor / SELinux policy | Applied to container processes at start | Container recreation |
containerd.io (containerd, runc) | runc builds the container; the shim supervises it | Container recreation for the fix to be real |
docker-ce | The daemon | Daemon restart |
| systemd | Owns the cgroup hierarchy the daemon delegates from | Usually nothing; occasionally a reboot |
| glibc, OpenSSL, zlib | Nothing β containers carry their own | Nothing on the host side |
That last row is the one that surprises people, and it cuts both ways. A
glibc CVE on the host does not affect containers, because each image ships its
own libc. But it also means patching the host does not patch your
containers: a glibc CVE inside myapp:release-2026-08 is fixed by rebuilding
the image, and no amount of host patching will touch it.
The unattended-upgrades problem
Ubuntu and Debian ship unattended-upgrades and it is a good default. On a
Docker host, the default configuration has a specific hazard.
$ grep -A 8 'Allowed-Origins' /etc/apt/apt.conf.d/50unattended-upgradesUnattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}";
"${distro_id}:${distro_codename}-security";
"${distro_id}ESMApps:${distro_codename}-apps-security";
"${distro_id}ESM:${distro_codename}-infra-security";
};Illustrative output
Read that carefully, because it is better news than the folklore suggests.
The default allows only origins whose distro_id matches the distribution.
Dockerβs repository publishes with a different origin:
$ grep -hE '^(Origin|Label|Suite)' /var/lib/apt/lists/download.docker.com*InReleaseLabel: Docker CE
Origin: Docker
Suite: nobleIllustrative output
So a stock unattended-upgrades does not upgrade Docker. Origin: Docker
is not in the allowed list.
# Is unattended-upgrades even enabled?
systemctl is-enabled unattended-upgrades.service apt-daily-upgrade.timer
# What does it consider in scope? (does not install anything)
sudo unattended-upgrade --dry-run --debug 2>&1 | head -40
# Anything else scheduled that touches apt?
sudo grep -rn 'apt-get\|apt ' /etc/cron.d/ /etc/cron.daily/ 2>/dev/null
# What is currently upgradable, and from which origin
apt list --upgradable 2>/dev/nullMaking it explicit
Do not rely on the default staying the default. State the exclusion.
// Docker Engine and containerd restart their services from the package
// postinstall. On this host that stops every container unless live-restore
// is enabled, so both are upgraded only in a maintenance window.
Unattended-Upgrade::Package-Blacklist {
"docker-ce$";
"docker-ce-cli$";
"containerd.io$";
};Two details matter. The $ anchors the pattern β these are Python regular
expressions matched against package names, and without the anchor docker-ce
also matches docker-ce-rootless-extras. And putting this in your own file
rather than editing 50unattended-upgrades means a package upgrade of
unattended-upgrades cannot silently revert it.
The belt-and-braces version is an apt pin, which stops manual mistakes too:
Package: docker-ce docker-ce-cli containerd.io
Pin: origin download.docker.com
Pin-Priority: 100Priority 100 means βinstalled, but do not upgrade automaticallyβ. An explicit
apt-get install docker-ce=<version> still works, which is exactly the
behaviour you want: automatic runs skip it, maintenance windows do not.
Cadences
| Stream | Cadence | Mechanism |
|---|---|---|
| Distribution security updates (excluding Docker, excluding kernel) | Automatic, daily | unattended-upgrades |
| Kernel | Monthly, or immediately for a rated CVE | Manual, with a reboot window |
| Docker packages | Monthly patch, quarterly feature | Maintenance window, the runbook from the upgrades part |
| Container images | Weekly rebuild, or on base image update | Build pipeline |
The kernel is separate from the automatic stream for one reason: installing a kernel is harmless and applying it requires a reboot. Automating the install without automating the reboot produces hosts that report as patched and are running the old kernel β the subject of the next lesson.
Knowledge check
Knowledge check Β· 4 questions
Q1. A critical glibc CVE is announced. You patch glibc on the Docker host. What is the effect on your containers?
Q2. Why does a stock unattended-upgrades configuration not upgrade Docker Engine?
Q3. Which host components change behaviour inside running or future containers when patched? Select all that apply.
Q4. After upgrading containerd.io to fix a runc CVE, every already-running container must be recreated before the fix applies to it.
Passing score: 75%. Answers are checked in this browser.