由于服务器重启的原因,docker很多容器都挂掉了,一个一个重启也不现实啊
[root@jhkj69 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b4cc4db91aa5 svn:v1.0 "/bin/bash" 7 days ago Exited (255) 4 minutes ago 0.0.0.0:3690->3690/tcp svn
86dbe800f386 system/centos:v3 "/usr/bin/supervisor…" 2 weeks ago Exited (255) 4 minutes ago 0.0.0.0:9000-9005->9000-9005/tcp, 0.0.0.0:4457->22/tcp sonarqube
209cf9f942cc system/jenkins:v7 "/usr/bin/supervisor…" 3 weeks ago Exited (255) 4 minutes ago 0.0.0.0:4455->22/tcp, 0.0.0.0:4456->8080/tcp jenkins-prod
c4db3fb6f633 jenkins:v2 "/usr/bin/supervisor…" 3 weeks ago Exited (255) 4 minutes ago 0.0.0.0:2164->22/tcp, 0.0.0.0:8888->8080/tcp jenkins
39a787178bb4 mysql:5.6 "/bin/bash" 4 weeks ago Exited (255) 4 minutes ago 0.0.0.0:3307->3306/tcp mysql
40f86eb77984 vmware/nginx-photon:v1.5.3 "nginx -g 'daemon of…" 4 weeks ago Up 3 minutes (unhealthy) 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp nginx
1265c5d9f7d2 vmware/harbor-jobservice:v1.5.3 "/harbor/start.sh" 4 weeks ago Up 10 seconds harbor-jobservice
da6e46f67127 vmware/harbor-ui:v1.5.3 "/harbor/start.sh" 4 weeks ago Up 24 seconds (health: starting) harbor-ui
7e2d77a9d66f vmware/harbor-db:v1.5.3 "/usr/local/bin/dock…" 4 weeks ago Exited (255) 4 minutes ago 3306/tcp harbor-db
95c074af618a vmware/redis-photon:v1.5.3 "docker-entrypoint.s…" 4 weeks ago Exited (255) 4 minutes ago 6379/tcp redis
217aeac62eca vmware/harbor-adminserver:v1.5.3 "/harbor/start.sh" 4 weeks ago Up 38 seconds (health: starting) harbor-adminserver
270b1d6dfcd6 vmware/registry-photon:v2.6.2-v1.5.3 "/entrypoint.sh serv…" 4 weeks ago Up 3 minutes (healthy) 5000/tcp registry
ed90e04c9bda vmware/harbor-log:v1.5.3 "/bin/sh -c /usr/loc…" 4 weeks ago Up 3 minutes (healthy) 127.0.0.1:1514->10514/tcp harbor-log
百度下决定试下这个命令:
[root@jhkj69 ~]# docker restart $(docker ps -a -q)
b4cc4db91aa5
86dbe800f386
209cf9f942cc
c4db3fb6f633
39a787178bb4
40f86eb77984
1265c5d9f7d2
da6e46f67127
7e2d77a9d66f
95c074af618a
217aeac62eca
270b1d6dfcd6
ed90e04c9bda
再次查看容器是否重启成功:
[root@jhkj69 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b4cc4db91aa5 svn:v1.0 "/bin/bash" 7 days ago Up 2 minutes 0.0.0.0:3690->3690/tcp svn
86dbe800f386 system/centos:v3 "/usr/bin/supervisor…" 2 weeks ago Up 2 minutes 0.0.0.0:9000-9005->9000-9005/tcp, 0.0.0.0:4457->22/tcp sonarqube
209cf9f942cc system/jenkins:v7 "/usr/bin/supervisor…" 3 weeks ago Up 2 minutes 0.0.0.0:4455->22/tcp, 0.0.0.0:4456->8080/tcp jenkins-prod
c4db3fb6f633 jenkins:v2 "/usr/bin/supervisor…" 3 weeks ago Up 2 minutes 0.0.0.0:2164->22/tcp, 0.0.0.0:8888->8080/tcp jenkins
39a787178bb4 mysql:5.6 "/bin/bash" 4 weeks ago Up 2 minutes 0.0.0.0:3307->3306/tcp mysql
40f86eb77984 vmware/nginx-photon:v1.5.3 "nginx -g 'daemon of…" 4 weeks ago Up 2 minutes (healthy) 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp nginx
1265c5d9f7d2 vmware/harbor-jobservice:v1.5.3 "/harbor/start.sh" 4 weeks ago Up About a minute harbor-jobservice
da6e46f67127 vmware/harbor-ui:v1.5.3 "/harbor/start.sh" 4 weeks ago Up About a minute (healthy) harbor-ui
7e2d77a9d66f vmware/harbor-db:v1.5.3 "/usr/local/bin/dock…" 4 weeks ago Up About a minute (healthy) 3306/tcp harbor-db
95c074af618a vmware/redis-photon:v1.5.3 "docker-entrypoint.s…" 4 weeks ago Up About a minute 6379/tcp redis
217aeac62eca vmware/harbor-adminserver:v1.5.3 "/harbor/start.sh" 4 weeks ago Up About a minute (healthy) harbor-adminserver
270b1d6dfcd6 vmware/registry-photon:v2.6.2-v1.5.3 "/entrypoint.sh serv…" 4 weeks ago Up About a minute (healthy) 5000/tcp registry
ed90e04c9bda vmware/harbor-log:v1.5.3 "/bin/sh -c /usr/loc…" 4 weeks ago Up 51 seconds (healthy) 127.0.0.1:1514->10514/tcp harbor-log