1.docker restart介绍
docker restart命令是用来重新启动一个或多个docker容器。
2.docker restart用法
docker restart [参数] container [container......]
[root@centos79 ~]# docker restart --help
Usage:  docker restart [OPTIONS] CONTAINER [CONTAINER...]
Restart one or more containers
Aliases:
  docker container restart, docker restart
Options:
  -s, --signal string   Signal to send to the container
  -t, --time int        Seconds to wait before killing the container
[root@centos79 ~]#3.实例
3.1.基于container id重启容器
命令:
docker restart 20ce
[root@centos79 ~]# docker ps -a | grep 20ce
20cebbe3fac3   daocloud.io/library/centos:latest   "/bin/bash"               3 days ago    Up About a minute                                                                                          centos-ztj
[root@centos79 ~]# docker restart 20ce
20ce
[root@centos79 ~]# docker ps -a | grep 20ce
20cebbe3fac3   daocloud.io/library/centos:latest   "/bin/bash"               3 days ago    Up 1 second                                                                                            centos-ztj
[root@centos79 ~]#3.2.基于container name重启容器
命令:
docker restart centos-ztj
[root@centos79 ~]# docker ps -a | grep 20ce
20cebbe3fac3   daocloud.io/library/centos:latest   "/bin/bash"               3 days ago    Up 46 seconds                                                                                          centos-ztj
[root@centos79 ~]# docker restart centos-ztj
centos-ztj
[root@centos79 ~]# docker ps -a | grep 20ce
20cebbe3fac3   daocloud.io/library/centos:latest   "/bin/bash"               3 days ago    Up 1 second                                                                                            centos-ztj
[root@centos79 ~]#









