I just discovered that service docker stop
on Ubuntu 18.04 doesn't shutdown all running containers. I can't control them anymore but the containerd-ship
processes and everything that's inside the containers is still running (but not reachable though, maybe because the network was removed).
Also, stopping containerd doesn't change anything because by design this doesn't stop the containers.
And even after killall containerd-shim
which is already quite harsh, some processes are still running, like gunicorn
from gitlab, backuppc, and a Linux UML instance
How do I do a clean shutdown of all running containers? The current behaviour is responsible that my system hangs while shutting down.
Update: I just saw that I'm using the repo (https://download.docker.com/linux/ubuntu) which comes from a Kubernetes tutorial (which I don't use yet). This source brings proprietary versions of containerd.io, docker-ce and docker-ce-cli
Problem solved.
The main point was that I had an additional repository, directly from docker (https://download.docker.com/linux/ubuntu) which brought proprietary versions of containerd.io, docker-ce and docker-ce-cli. Ubuntu universe on the other hand wasn't even in my
/etc/apt/source.list
.I now updated to 20.04 and use the original docker packages (docker.io) from ubuntu universe. This works fine, and shuts down as expected. I'm sure this would also have worked on 18.04, but wanted to avoid downgrading docker by switching the repo.
On my Ubuntu 18.04 installation
systemctl stop docker
shuts down all running containers.systemctl start docker
starts all containers again. I agree with BMitch, one would need more information about your installation to diagnose the issue.Another way of shutting down all running containers would be: