当前位置:   article > 正文

docker开机启动设置

docker开机启动设置

添加开机启动

# 添加开机启动配置
sudo vim /usr/lib/systemd/system/docker.service

文件内容

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target

添加执行权限

chmod +x /usr/lib/systemd/system/docker.service
sudo systemctl daemon-reload

启动Docker

sudo systemctl start docker

配置开机启动

sudo systemctl enable docker 

如果上面的命令执行不成功,可通过以下方式实现

echo "systemctl start docker" > /etc/rc.local
chmod +x /etc/rc.local
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/220941
推荐阅读
相关标签
  

闽ICP备14008679号