在centos7 上完成docker的基本安装,执行启动命令时,发现无法启动:
command : sudo systemctl start docker
err : exit status 1
output : Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
通过systemctl status docker.service查看日志信息:
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/docker.service.d
└─10-machine.conf
Active: failed (Result: start-limit-hit) since Mon 2017-07-03 17:48:03 UTC; 3min 38s ago
Docs: https://docs.docker.com
Process: 5803 ExecStart=/usr/bin/dockerd daemon -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/dock
Main PID: 5803 (code=exited, status=1/FAILURE)
发现此类问题是由于ExecStart的配置导致的。有解决方案说将ExecStart=/usr/bin/docker 改为ExecStart=/usr/bin/dockerd。但发现安装之后使用的就是dockerd。后追查发现,主要原因是/etc/systemd/system/docker.service.d目录下,没有对应的配置文件。
于是,开始生成对应的文件。可通过以下操作进行解决:
sudo systemctl edit docker.service
新增内容:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://127.0.0.1:2375
会生成这样一个文件:
/etc/systemd/system/docker.service.d/override.conf
然后依次执行:
sudo systemctl daemon-reload
sudo systemctl restart docker.service
即可正常启动。
原文链接:http://www.choupangxia.com/topic/detail/154