Assignment for docker day1
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
2. What is the difference between docker stop and docker kill?
Docker stop / kill commands are used to stop the running docker container.
After docker stop <name>,
“docker ps -a ” will show the status as Exited (0)
But after docker kill <name>,
“docker ps -a ” will show the status as Exited (137).
ie, docker stop sends SIGTERM as process end signal and SIGKILL is send by docker kill.
root@ip-172-31-28-155:/home/ubuntu# docker start abhi
abhi
root@ip-172-31-28-155:/home/ubuntu# docker ps -a | grep abhi
2d0eb09c5f08 httpd “httpd-foreground” 18 minutes ago Up 7 seconds 80/tcp abhi
root@ip-172-31-28-155:/home/ubuntu# docker stop abhi
abhi
root@ip-172-31-28-155:/home/ubuntu# docker ps -a | grep abhi
2d0eb09c5f08 httpd “httpd-foreground” 18 minutes ago Exited (0) 4 seconds ago abhi
root@ip-172-31-28-155:/home/ubuntu# docker start abhi
abhi
root@ip-172-31-28-155:/home/ubuntu# docker kill abhi
abhi
root@ip-172-31-28-155:/home/ubuntu# docker ps -a | grep abhi
2d0eb09c5f08 httpd “httpd-foreground” 18 minutes ago Exited (137) 2 seconds ago abhi
root@ip-172-31-28-155:/home/ubuntu#