服务自启动
查看已启动的服务
systemctl list-units --type=service
查看是否设置开机启动
systemctl list-unit-files | grep enable
设置开机启动
systemctl enable docker.service
关闭开机启动
systemctl disable docker.service
容器自启动
已有的容器更新为自动重启
docker update --restart=always 容器ID(或者容器名)
创建容器的时候设置容器为自动重启 命令行中加参数 --restart=always
docker run -d --restart=always --name 设置容器名 使用的镜像