Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop a docker container which started with `--restart=always`

Tags:

docker

Is there any way to stop a docker container which started with --restart=always like following

sudo docker run -it --restart=always <image_id>

like image 444
Rafaf Tahsin Avatar asked Aug 22 '16 06:08

Rafaf Tahsin


People also ask

How do I stop a docker container from restarting?

If you want to stop a docker container here's the command to do it. The main process inside the container will receive SIGTERM, and after a grace period, SIGKILL. This will stop a running container.

How do you stop a docker container that won't stop?

docker rm -f The final option for stopping a running container is to use the --force or -f flag in conjunction with the docker rm command. Typically, docker rm is used to remove an already stopped container, but the use of the -f flag will cause it to first issue a SIGKILL.

How do I stop an existing docker container?

To stop one or more running Docker containers, you can use the docker stop command. The syntax is simple: $ docker stop [OPTIONS] CONTAINER [CONTAINER...] You can specify one or more containers to stop.

How do you stop a container automatically?

You can stop this by adding --interactive --tty (or just -it ) to your docker run ... command, which will let you type commands into the shell. The process inside the container has been terminated: This is when the program that runs inside the container is given a signal to shut down.


1 Answers

Here's the mighty eagle that docker has recently included. :D

You can update docker container.

use sudo docker update --restart=no <container_id> to update --restart flag of the container.

Now you can stop the container.

like image 197
Rafaf Tahsin Avatar answered Oct 09 '22 12:10

Rafaf Tahsin