3. What is the difference between docker stop and kill?
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
docker stop attempts to gracefully shutdown container(s) while docker kill (by default) immediately stops/terminates them;
docker stop issues a SIGTERM signal to the main process inside the container
docker kill (by default) issues a SIGKILL signal.
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.
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.