Debug School

varunakg
varunakg

Posted on

Diff between docker stop and docker kill?

Answer : Stop attempts to trigger a graceful shutdown by sending the standard POSIX signal whereas kill just kills the process by default.

[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b32155889703 httpd "httpd-foreground" About a minute ago Created vj2
15321b2e4b20 httpd "httpd-foreground" 2 minutes ago Exited (0) 5 seconds ago vj1
d9362521b23b httpd "httpd-foreground" 3 minutes ago Created agitated_jackson
b14acb2bfc36 hello-world "/hello" 3 hours ago Exited (0) 3 hours ago awesome_zhukovsky
693a7fc72262 hello-world "/hello" 3 hours ago Exited (0) 3 hours ago quirky_wiles
[root@localhost ~]# docker start vj1
vj1
[root@localhost ~]# docker stop vj1
vj1
[root@localhost ~]# docker start vj1
vj1
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b32155889703 httpd "httpd-foreground" 2 minutes ago Created vj2
15321b2e4b20 httpd "httpd-foreground" 2 minutes ago Up 6 seconds 80/tcp vj1
d9362521b23b httpd "httpd-foreground" 3 minutes ago Created agitated_jackson
b14acb2bfc36 hello-world "/hello" 3 hours ago Exited (0) 3 hours ago awesome_zhukovsky
693a7fc72262 hello-world "/hello" 3 hours ago Exited (0) 3 hours ago quirky_wiles
[root@localhost ~]# docker kill vj1
vj1
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b32155889703 httpd "httpd-foreground" 3 minutes ago Created vj2
15321b2e4b20 httpd "httpd-foreground" 4 minutes ago Exited (137) 9 seconds ago vj1
d9362521b23b httpd "httpd-foreground" 5 minutes ago Created agitated_jackson
b14acb2bfc36 hello-world "/hello" 3 hours ago Exited (0) 3 hours ago awesome_zhukovsky
693a7fc72262 hello-world "/hello" 3 hours ago Exited (0) 3 hours ago quirky_wiles

Top comments (0)