What's the Difference Between "docker stop" and "docker kill" Commands?

"docker stop" vs. "docker kill"

The docker stop and docker kill commands have the following differences:

  1. docker stop attempts to gracefully shutdown container(s) while docker kill (by default) immediately stops/terminates them;
  2. docker stop issues a SIGTERM signal to the main process inside the container, while docker kill (by default) issues a SIGKILL signal;
  3. With docker kill, you may specify to send a different signal (to the main process inside the container) than the default SIGKILL signal, using the --signal flag. Same thing is not possible with the docker stop command;
  4. With docker stop, the container(s) must comply to the shutdown request within a (configurable) grace period (which defaults to 10 seconds), after which it forcibly tries to kill the container. docker kill does not have any such timeout period.

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