Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kill a Docker Container

Tags:

I've set up a Docker container for my node app and ran it using

docker run -p 4500:4500 my_node_app 

It launched pm2 in no-daemon mode. CTRL+C and exit don't work. I've tried docker stop my_node_app in another terminal window but to no avail. Appreciate any help.

like image 932
Coder_Nick Avatar asked Jun 25 '18 02:06

Coder_Nick


People also ask

How do you kill a docker container?

Kill All Containers Using Docker Compose If you do, killing multiple containers takes one command: docker-compose down. You could also run docker-compose without detached mode. If so, you'll just use ^C to kill all containers. And there you have it—all containers killed!

How do I force kill a docker container?

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 kill a docker container in Terminal?

Run YouTrack docker container Note that pressing `Ctrl+C` when the terminal is attached to a container output causes the container to shut down.

How do I kill and remove a docker container?

docker container kill $(docker ps -q) — Kill all running containers. Then you delete the container with: docker container rm my_container — Delete one or more containers. docker container rm $(docker ps -a -q) — Delete all containers that are not running.


1 Answers

You will be able to see currently running docker containers using below command.

docker ps

Then copy the CONTAINER ID of the running container and execute the following command

docker stop <container_id>

Please replace with a real value.

like image 136
srimaln91 Avatar answered Sep 30 '22 06:09

srimaln91