Centos 7配置docker.service
由于centos7使用了新的服务管理工具 systemctl 来代替 service,所以配置文件好像都放在了 /lib/systemd/system/ 中以 .service 结尾。
修改配置文件
打开 /lib/systemd/system/docker.service ,在 [Service] 下添加 EnvironmentFile=/etc/sysconfig/docker
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/docker
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/docker daemon -H fd://
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
[Install]
WantedBy=multi-user.target
在 /etc/sysconfig/docker 下新建 docker 文件就可以像之前那样使用docker了