New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--restart=unless-stopped
does not restart containers after daemon restart
#652
Comments
@Malvineous If your docker container got killed while you
As a suggestion, You should see the output of |
The Docker container does not get killed, it runs successfully for many days after starting it. The machine can reboot and the container will come up again after rebooting (or at least it did the last time I rebooted, which was on an earlier Docker version.) Now, like I said in the 'steps to reproduce' above, the container starts successfully and can again run for many days, however once you restart the Docker daemon with
|
I have the same problem. After upgrading from older version to 18.09.1 containers that were running up to the moment the system is rebooted are not started after system reboot. As a workaround i changed the restart policy (docker update --restart=always:0 my-container) which works for me but it would be nice if this bug can be solved! |
I have the same problem here, on Docker CE 19.03.2 |
I think when you reboot, systemd will stop the docker service, which in turn takes care of stopping all containers. |
This might be the case, but then the bug is that when Docker is being shut down, it also marks all the containers as stopped even though the user did not request the containers be stopped. The containers should only be marked as stopped when |
I hit a similar issue to this. The cause ended up being using Docker 19.03.4, CentOS 7.6 |
@markgoddard Using In the case of this bug, we haven't stopped the containers (just rebooted the system) but Docker is acting as if we have requested each container be permanently stopped, when we haven't made such a request. |
I'm using SIGHUP, which doesn't typically kill a process. I found an old docker bug about the issue: moby/moby#11065. Thanks for replying. |
Having the same issue on Cent 7, Docker version 19.03.8. |
Having this issue with Ubuntu 18.04 on system reboot. Some containers restart, some don't.
|
I know this issue isn't related to windows but just wanted to say since this article pulls up when searching this issue on Google that I also have the issue when our Windows Server 2016 server gets rebooted. |
+1
As a workaround I switched to docker-ce package from 18.04 repository (because armhf has no release candidate in the 20.04 repository as per #1035)
|
Also receiving this issue on an Ubuntu 20.04 VM running inside ESXi, using $ docker -v
Docker version 19.03.8, build afacb8b7f0 I tried upgrading to I'm noticing this guide specifically says If so, perhaps the |
Thank you, this solved a problem I was having too. I use docker kill -sHUP to reload the configuration of a daemon, but I didn't realize it would cause Docker to assume the container should be in a stopped state! |
While waiting for a fix, here is a workaround that doesn't break the restart policy
Enjoy :o) |
I found this bug while researching a similar issue. Containers set to restart (via docker compose) "unless-stopped" not restarting when the docker daemon reloads. Twice now I have had the docker daemon abruptly exit due to a nil pointer condition, while I haven't been able to find a reason for that I was surprised that my containers were not coming back up when the daemon managed to restart. I would have thought that the daemon failing for whatever reason would have resulted in the containers all being restarted. as a bandaid I have set all my containers to a restart policy of "always" |
Expected behavior
Launching a container with
--restart=unless-stopped
should restart the container when the daemon reloads.Actual behavior
Containers are not restarted. The docs say they will be restarted unless they are stopped first, but restarting the daemon doesn't imply changing any containers to the 'stopped' state. (e.g. in my case I just upgraded Docker, and the
docker
CLI couldn't communicate with the still-running old daemon version, so I wanted to restart the daemon. Doing so allowed the CLI to communicate with it again, but all my containers disappeared.)Steps to reproduce the behavior
Output of
docker version
:Output of
docker info
:The text was updated successfully, but these errors were encountered: