Docker container keeps restarting

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.


it keeps restarting because you're using --restart=always flag

Run

docker logs <CONTAINER_ID>

to see if your code is encountering any errors that does not allow the container to run properly

Tags:

Docker