合 容器随着docker的启动而自动启动(自动重启)
创建时添加--restart=always
1 2 3 4 5 6 7 8 9 | docker rm -f lhrcentos76 docker run -itd --name lhrcentos76 -h lhrcentos76 \ --net=dbnw --ip 192.168.68.66 \ -p 8566:8500 -p 33389:3389 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --restart=always \ --privileged=true lhrbest/lhrcentos76:9.2 \ /usr/sbin/init |
直接修改
1 2 3 4 5 6 | # docker inspect lhrcentos76 | grep -i RestartPolicy -A 3 docker container update --restart=always lhrcentos76 docker update --restart=always lhrcentos76 docker update --restart=always mdw smdw sdw1 sdw2 sdw3 sdw4 |