重启了服务器,docker没有设置自启动,开机后掉线
重启docker
systemctl start docker
查看容器,都是Exited状态
root@localhost:~# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d5b6239f7dca mysql:5.6 "docker-entrypoint.s…" 16 hours ago Exited (255) 14 seconds ago 0.0.0.0:3307->3306/tcp kiwimysql2 7333ae43880c mysql:5.6 "docker-entrypoint.s…" 16 hours ago Created kiwimysql 720c76a80511 nginx "nginx -g 'daemon of…" 22 hours ago Exited (255) 14 seconds ago 0.0.0.0:8083->80/tcp kiwis-php-nginx e495d06f15df php:7.2.9-fpm "docker-php-entrypoi…" 23 hours ago Exited (255) 14 seconds ago 9000/tcp kiwiphp-fpm
重启容器
docker start kiwimysql2 //或者 docker start d5b6239f7dca
注意重启nginx提示 php容器未启动,要先启动php容器
root@localhost:~# docker start kiwis-php-nginx Error response from daemon: Cannot link to a non running container: /kiwiphp-fpm AS /kiwis-php-nginx/php
其他
docker rm CONTAINER_ID | NAMES 删除容器
docker start CONTAINER_ID | NAMES 启动容器
docker stop CONTAINER_ID | NAMES 停掉运行中的容器