源码安装docker,创建docker.service服务

环境:CentOS 7(core1708)
版本:Docker version 18.03.1-ce
安装过程请看https://blog.csdn.net/lituxiu/article/details/100515996
参照github上的大神链接https://github.com/moby/moby/blob/master/contrib/init/systemd/docker.service

vi /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
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

安装完毕后
systemctl daemon-reload
systemctl start docker  #成功即可
(注意:如果不先输入systemctl start docker的话,先输入systemctl start docker会报错

你可能感兴趣的:(docker)