I have set live-restore for most Docker hosts to support smooth minor version upgrades, but the documentation states that this feature is not suitable for major version upgrades. So the question is how to shut down dockerd and all containers, as if live-restore was not set?
Of course I can loop over all containers to shut them down one-by-one, but I would guess that dockerd uses a different procedure. Surely it can avoid starting new containers once it has received the signal to shutdown. The external loop cannot. Not to mention that the next Docker version might introduce new features/integrations that have to be taken into account. There has to be some "docker-style" way to do this.
2
Answers
I guess I figured it out myself:
Correct me if I am wrong.
I would like to have some sort of
systemctl stopall docker
that stopped the daemon and the containers when live-restore is active. It certainly would be useful in some situations. Unfortunately there does not appear to be a way to opt-in to non-live-restore behavior temporarily. Instead I use:docker ps -q | xargs docker kill && systemctl stop docker
There is a very small window of time between killing all the containers and stopping docker that a container can be started, so its not perfect.