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

DevOps

MOTOSHARE 🚗🏍️
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
🚀 Everyone wins.

Start Your Journey with Motoshare

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)