Centos7设置Mysql自启动
先让docker开机自启动
启动Docker
Systemctl start docker
关闭Docker
Systemctl stop docker
设置docker开机自启动
Systemctl enable docker
docker ps
查看容器id
[root@localhost xl]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9fafbcba58b0 mysql:5.7 "docker-entrypoint.s…" 2 weeks ago Up 17 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
设置自启动
[root@localhost xl]# docker update --restart=always 9fafbcba58b0
9fafbcba58b0
取消自启动
[root@localhost xl]# docker update --restart=no 9fafbcba58b0
9fafbcba58b0