A docker basic command❤️
1 Docker starts automatically when booting
(1) Set docker to start automatically when booting:
systemctl enable docker
(2) Cancel auto-start at boot:
systemctl disable docker
(3) Other basic commands:
#启动docker:
systemctl start docker
#停止dokcer:
systemctl stop docker
#查看docker状态:
systemctl status docker
#重启docker:
systemctl restart docker
2 Set the container to automatically restart
docker run -d --restart=always --name 设置容器名 使用的镜像
--restart Specific parameter value details :
no // Default policy, do not restart the container when the container exits;
on-failure // Restart the container only when the container exits abnormally;
on-failure:3 // When the container exits abnormally Restart the container, up to 3 times;
always // Restart the container regardless of the exit status;
un