What Does the "docker kill" Command Do?

When you use the docker kill command, by default it immediately stops/kills the container (without giving it an opportunity to shutdown gracefully). It does so by sending the SIGKILL signal to the main process inside the container. However, you can send a different signal (instead of SIGKILL) using the --signal flag. For example, to send a SIGINT signal (which is equivalent to doing Ctrl + C inside of terminal), you can do the following:

docker kill --signal=SIGINT container_name

Please note that docker kill <container_name> command is synonymous to the new docker container kill <container_name> command. While both work, the latter/newer syntax was introduced to make the commands more verbose, so that the commands are more obvious in what they do.

Hope you found this post useful. It was published . Please show your love and support by sharing this post.