Docker Container Kill
This command will kill one or more running containers. It kills the process abruptly inside the container. One might confuse this with docker stop. But docker stop just stops the processes inside the container while docker kill command will kill the process itself.
Syntax
docker kill [OPTIONS] CONTAINER [CONTAINER...]
Options
--signal, s: Signal to send to the container
Examples
The following example sends the default KILL signal to the container
docker kill my_container
learning-ocean:~ gaurav$ docker container run -itd nginx
89d34da28b5d4a4e15a6262cb6414106527a377eeeebdcf7aa4a7e8ef766260b
learning-ocean:~ gaurav$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
89d34da28b5d nginx "/docker-entrypoint.…" 5 seconds ago Up 4 seconds 80/tcp happy_cori
let kill the container using below command
learning-ocean:~ gaurav$ docker container kill 89
89
learning-ocean:~ gaurav$
Be careful while running this command as it may cause severe issues if executed in a prod environment by mistake.