终止容器

可以使用docker stop来终止一个运行中的容器.
该命令首先向容器发送SIGTERM信号,等待一段时间后,再发送SIGKILL信号来终止容器.

[root@6 ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
204f49063b1e        nginx:latest        "nginx -g 'daemon of…"   2 weeks ago         Up 21 seconds       80/tcp              admiring_nightingale
[root@6 ~]# docker stop 204f49063b1e
204f49063b1e
[root@6 ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES
204f49063b1e        nginx:latest        "nginx -g 'daemon of…"   2 weeks ago         Exited (0) 20 seconds ago                       admiring_nightingale
[root@6 ~]#