# 添加开机启动配置 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