From 1472580c4bcb8a0445d017d6cdaba41441f698a3 Mon Sep 17 00:00:00 2001 From: Robert Gingras Date: Fri, 31 Jul 2026 10:03:52 -0400 Subject: [PATCH] perf(docker): socket-activate dockerd instead of starting it at boot Enable only docker.socket, not docker.service, so dockerd (and its containerd dependency) start lazily on first use of /run/docker.sock rather than eagerly at container boot. Containers that never touch Docker no longer pay for an idle dockerd + containerd. The stock docker.service already ships the canonical socket-activation setup (ExecStart uses `-H fd://` and it declares Requires=docker.socket), so enabling the socket alone is sufficient: the first client connection starts the service on demand. containerd has no socket unit and cannot be socket-activated itself, but docker.service pulls it in (Wants/After=containerd.service), so it too stays stopped until Docker is first used. Verified: with only docker.socket enabled, `systemctl is-active docker.service` reports inactive at boot; `docker info` (first socket connection) transparently starts dockerd, which in turn brings up containerd; both then report active. --- images/docker/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/images/docker/Dockerfile b/images/docker/Dockerfile index 63d21d2d..e044d50e 100644 --- a/images/docker/Dockerfile +++ b/images/docker/Dockerfile @@ -20,7 +20,8 @@ RUN curl -fsSL https://download.docker.com/linux/debian/gpg \ containerd.io \ docker-buildx-plugin \ docker-compose-plugin && \ - systemctl enable docker.service docker.socket && \ + systemctl disable docker.service && \ + systemctl enable docker.socket && \ apt-get clean && \ rm -rf /var/lib/apt/lists/*