目录
- 一、docker服务设置自动启动
- 二、docker容器设置自动启动
https://my.oschina.net/lwenhao/blog/1923003
说明:适用于yum安装的各种服务
systemctl list-units --type=service
systemctl list-unit-files | grep enable
systemctl enable docker.service
systemctl disable docker.service
docker run -tid --name isaler_v0.0.11 -p 8081:8080 --restart=always -v /alidata/iDocker/run/projectImages/isaler/v0.0.11/log:/usr/local/tomcat/logs isaler_v0.0.11
Flag Description
no 不自动重启容器. (默认value)
on-failure 容器发生error而退出(容器退出状态不为0)重启容器
unless-stopped 在容器已经stop掉或Docker stoped/restarted的时候才重启容器
always 在容器已经stop掉或Docker stoped/restarted的时候才重启容器
如果已经启动的项目,则使用update更新:
docker update --restart=always isaler_v0.0.11