Day-1: Q2. What is the difference between docker stop and docker 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!

Enroll Now

docker stop stops the container gracefully where as docker kill terminates the process immediately. docker stop showing status as “Exited (0)” and docker kill showing status as “Exited (137)”

root@ip-172-31-28-155:/home/ubuntu# docker start anoop2
anoop2
root@ip-172-31-28-155:/home/ubuntu# docker start anoop1
anoop1
root@ip-172-31-28-155:/home/ubuntu# docker ps -a | grep anoop
c5a741893181   httpd          "httpd-foreground"       4 minutes ago        Up 23 seconds                       80/tcp    anoop2
fc660bad9f21   httpd          "httpd-foreground"       4 minutes ago        Up 18 seconds           

root@ip-172-31-28-155:/home/ubuntu# docker stop anoop1
anoop1
root@ip-172-31-28-155:/home/ubuntu# docker kill anoop2
anoop2

root@ip-172-31-28-155:/home/ubuntu# docker ps -a | grep anoop
c5a741893181   httpd          "httpd-foreground"       4 minutes ago    Exited (137) 9 seconds ago              anoop2
fc660bad9f21   httpd          "httpd-foreground"       5 minutes ago    Exited (0) 12 seconds ago               anoop1