I was trying rancher. I used the command: sudo docker run -d --restart=always -p 8080:8080 rancher/server to start run it. Then I stopped the container and removed it. But if I stop and restart the docker daemon or reboot my laptop, and lookup running containers using docker ps command, it will have rancher server running again. How do I stop/remove it completely and make sure it will not run again.
use sudo docker update --restart=no <container_id> to update --restart flag of the container. Now you can stop the container. Show activity on this post. You should be able to just use docker stop and then docker rm to make sure the container doesn't restart when the daemon restarts.
Use a restart policy Restart the container if it exits due to an error, which manifests as a non-zero exit code. Optionally, limit the number of times the Docker daemon attempts to restart the container using the :max-retries option.
Note that pressing `Ctrl+C` when the terminal is attached to a container output causes the container to shut down.
Note: following issue 11008 and PR 15348 (commit fd8b25c, docker v1.11.2), you would avoid the issue with:
sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server
In your current situation, thanks to PR 19116, you can use docker update
to update the restart policy.
docker update --restart=unless-stopped <yourContainerID_or_Name>
Then stop your container, restart your docker daemon: it won't restart said container.
The OP codefire points to another reason in the comments:
When I first ran the start rancher server command, I didn't notice that it was being downloaded. So I may have retried that command a couple times.
That must be why the job kept on restarting even after stopping and removing containers that was started as rancher server.
After stopping and removing 8+ containers, it finally stopped
That is why I have aliases to quickly remove any stopped containers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With