How can I stop and remove the docker container running with the ability to reboot?

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

This works well, so well that it’s hard for me to stop these containers now :)

I tried:

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

But the container is still reloading.

The docker documentation explains restart policies, but I did not find anything to solve this problem.

+6
source share
2 answers

Many thanks to those who take time to respond.

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

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

I think my problem is that this is some kind of incompatibility between the process manager and the docker.

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

More information on managing docker container launch can be found on the docker website.

+2
source

Just

 sudo docker rm -f container 

will kill the process if it is running, and remove the container in one step.

However, I could not repeat the symptoms you described. If I run with --restart=always , docker stop will stop the process and remain stopped.

I am using Docker version 1.3.1.

+4
source

Source: https://habr.com/ru/post/979078/


All Articles