When a currently running Docker container becomes unresponsive and cannot be stopped, it can be terminated immediately by sending the SIGKILL signal. This tutorial demonstrates how to terminate a running Docker container.
Terminate container
To terminate a running container by its ID or name, use docker kill command or docker container command with kill argument. For example, to terminate a container named redis, you can use:
docker kill redis
docker container kill redis
Terminate multiple containers
There is a way to terminate multiple containers at a time by specifying ID or name of the containers.
docker kill redis nginx
docker container kill redis nginx
Terminate container with different signal
By default, the SIGKILL signal is sent to terminate a running container. The --signal or -s option can be used to specify a signal that is sent to the container.
docker kill -s SIGINT redis
docker container kill -s SIGINT redis
Leave a Comment
Cancel reply