Docker hanging on reboot

Anybody else having a problem with Docker hanging if containers are still running at reboot?

I tried this solution but it isn’t working …

It’s likely this is caused by docker running a process that ignores the usual SIGTERM. You’ll need to ask docker to use SIGKILL for that process, or fix the process in question.

Rather than writing another systemd unit that mercilessly murders all your containers, I’d suggest adding an ExecStop to the offending unit that asks docker to specifically SIGKILL that container with docker kill -s SIGKILL.

Thanks @TLATER ! That makes sense. Is there a good way to tell which containers are the offending ones? I don’t see anything helpful in the console output while the machine is rebooting. Is almost seems like every container on my machine is a problem.

Also how do I add ExecStop to an offending unit? I am just using docker-compose to start and stop these containers.

Ah, that’s annoying. I’d assumed you were launching docker containers with systemd.

A quick way to check if any of them have this problem is to use docker-compose kill -s SIGTERM on each. If any of them are hanging that should take longer than usual.

Alas, not option. Writing a unit to SIGKILL a specific container (whichever ones end up hanging) is probably the best option in this case. I’m not sure if docker-compose has some strange interaction with how containers are killed on shutdown, so maybe my theory is wrong.

For me using virtualisation.docker.liveRestore = false helped to mitigate the “waiting for a stop job docker” thing.


Thanks @NobbZ that did the trick!