Search code examples
dockerpuppet

How can I stop and delete a docker container launched with restart always option?


I run some containers with the option --restart always.

It works good, so good, that I have now difficulties to stop these containers now :)

I tried :

sudo docker stop container && sudo docker rm -f container

But the container still restarts.

The docker documentation explains the restart policies, but I didn't find anything to resolve this issue.


Solution

  • Many thanks for those who takes time to respond.

    If you use docker directly, Bryan is right sudo docker rm -f container is enough.

    My problem was mainly that I use puppet to deploy docker images and run containers. I use this module and it creates entries in /etc/init for the upstart process manager.

    I think, my problem whas that, some kind of incompatibilities between the process manager and docker.

    In this situation, to halt a container, simply sudo stop docker-container.

    More informations on managing docker container run can be found on the docker website