feat(docker): add opt-in boot and shutdown units for hosts that run Docker with live-restore
Build / build (pull_request) Successful in 27s
Lint / lint (pull_request) Successful in 2m15s
Molecule / molecule (pull_request) Successful in 4m17s

docker_start_missed installs a boot unit that starts the containers dockerd's
restore pass skipped after a reboot of the whole host. docker_stop_at_shutdown
installs a unit that ends container processes at shutdown while the network and
NFS shares are still up, so a container holding an NFS mount no longer stalls
the shutdown. Both default to false and do nothing without /usr/bin/docker.

Refs #369

Assisted-by: Claude Code
This commit is contained in:
Dragonish committed 2026-11-25 17:31:37 +00:00
1 parent 4a7189c067
commit 567e9cca7c
16 files changed
+917 -6

No files matched your search

+16
View File
@@ -30,3 +30,19 @@ docker_users: []
# Docker manipulates iptables directly for any published container port
# (`-p`), bypassing UFW rules entirely - so the role owns no UFW rule and does
# not call the ufw role.
# With live-restore Docker leaves containers running when dockerd stops, but a reboot of the whole host kills them, and dockerd's restore
# pass at the next boot sometimes skips one without trying. When true, a boot unit starts the containers that Docker left down: only
# those exited with code 255 during this boot whose restart policy is unless-stopped or always, so one stopped on purpose stays stopped.
# Off by default; set it on a host that runs Docker with live-restore.
docker_start_missed: false
# Seconds to wait after Docker answers, so dockerd's own restarts finish first.
docker_start_missed_settle_seconds: 30
# With live-restore dockerd does not stop containers at host shutdown, and systemd-shutdown signals them only after the network is gone. A
# container that holds an NFS mount then blocks in the kernel's final unmount until the SIGKILL timer, and the host takes minutes to stop.
# When true, a shutdown unit sends SIGTERM to every container process while the network and NFS are still up, waits up to
# docker_stop_at_shutdown_timeout seconds, then SIGKILL. It never uses `docker stop`, so the manually-stopped marker is not set.
# Off by default; set it on a host whose containers mount NFS shares.
docker_stop_at_shutdown: false
docker_stop_at_shutdown_timeout: 30