Q2. What is the difference between docker stop and docker kill?

DevOps

YOUR COSMETIC CARE STARTS HERE

Find the Best Cosmetic Hospitals

Trusted • Curated • Easy

Looking for the right place for a cosmetic procedure? Explore top cosmetic hospitals in one place and choose with confidence.

“Small steps lead to big changes — today is a perfect day to begin.”

Explore Cosmetic Hospitals Compare hospitals, services & options quickly.

✓ Shortlist providers • ✓ Review options • ✓ Take the next step with confidence

One can stop and kill a running container. Docker stop will only stop the container gracefully. Docker kill will immediately kills all the process. There is a difference in exit code..

root@ip-172-31-28-155:/home/ubuntu# docker stop rajuc
rajuc
root@ip-172-31-28-155:/home/ubuntu# docker ps -a | grep rajuc
548886386f8b   httpd          "httpd-foreground"       30 minutes ago      Exited (0) 7 seconds ago                rajuc


root@ip-172-31-28-155:/home/ubuntu# docker kill rajuc
rajuc
root@ip-172-31-28-155:/home/ubuntu# docker ps -a | grep rajuc
548886386f8b   httpd          "httpd-foreground"       31 minutes ago      Exited (137) 8 seconds ago              rajuc

Code language: PHP (php)