无法在CentOS7中启动docker守护程序

时间:2017-02-14 03:44:54

标签: docker

执行var myPopup = $ionicPopup.show({ template: '<input type="password" ng-model="userdata.password2">' title: 'Change Password', scope: $scope, buttons: [ { text: 'Ok' }, { type: 'button-positive', onTap: function(e) { if(e == true) { myPopup.close(); $location.path('/page14'); } } } ] }); 后,我得到了:

  

无法启动docker.service:找不到单位。

这是systemctl start docker的输出:

systemctl status docker -l

但我可以使用[root@HP11012078 init.d]# systemctl status docker -l ● docker.service - Docker Application Container Engine Loaded: loaded (/etc/systemd/system/docker.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: https://docs.docker.com Feb 09 17:04:35 HP11012078 docker[28152]: time="2017-02-09T17:04:35.104333869+08:00" level=warning msg="container 58a5c6ba6710240bb5b1fd79e4600b547cf4c882eb2ca85e15c59c1404106877 restart canceled" Feb 09 17:04:35 HP11012078 docker[28152]: time="2017-02-09T17:04:35.113914527+08:00" level=warning msg="container d320ba5f02cdd8567893acfc62b6673a24b6c8a43ccb52342bb3470ff420230d restart canceled" Feb 09 17:04:35 HP11012078 docker[28152]: time="2017-02-09T17:04:35.122613873+08:00" level=warning msg="container 4030daadb9481a1b96b7a5c614c8910a601f83f2dced8340f4ea4c3583e7e844 restart canceled" Feb 09 17:04:45 HP11012078 docker[28152]: time="2017-02-09T17:04:45.002120051+08:00" level=info msg="Container c13f11ce792c477d9b663c6fdbcfe9694663f7843a40540c58922893f4b41247 failed to exit within 10 seconds of signal 15 - using the force" Feb 09 17:04:45 HP11012078 docker[28152]: time="2017-02-09T17:04:45.002120421+08:00" level=info msg="Container 0457d15d8b0bc83458dd3eea0c0b84699465da9746defc2429db89e426dbfa75 failed to exit within 10 seconds of signal 15 - using the force" Feb 09 17:04:45 HP11012078 docker[28152]: time="2017-02-09T17:04:45.002870012+08:00" level=warning msg="Cannot kill container c13f11ce792c477d9b663c6fdbcfe9694663f7843a40540c58922893f4b41247: rpc error: code = 2 desc = \"containerd: container not found\"" Feb 09 17:04:45 HP11012078 docker[28152]: time="2017-02-09T17:04:45.049505738+08:00" level=warning msg="container 0457d15d8b0bc83458dd3eea0c0b84699465da9746defc2429db89e426dbfa75 restart canceled" Feb 09 17:04:45 HP11012078 docker[28152]: time="2017-02-09T17:04:45.173034929+08:00" level=error msg="Force shutdown daemon" Feb 09 17:04:45 HP11012078 docker[28152]: time="2017-02-09T17:04:45+08:00" level=info msg="stopping containerd after receiving terminated" Feb 09 17:04:46 HP11012078 systemd[1]: Stopped Docker Application Container Engine. 命令启动docker。请帮助

4 个答案:

答案 0 :(得分:11)

要解决此问题,必须创建一个丢失的文件:/usr/lib/systemd/system/docker.socket

[Unit]
Description=Docker Socket for the API
PartOf=docker.service

[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target

然后运行:

systemctl daemon-reload
systemctl start docker.socket
systemctl start docker

然后Docker将启动。看起来安装会删除该文件并且不会替换它。

答案 1 :(得分:3)

如果在CentOS 8上安装Docker时遇到此错误:

在CentOS 8.1上,podman手册与docker-ce冲突(podman是Red Hat的容器引擎,并且已预先安装以替代Docker)。

一个简单的解决方案是在不需要时卸载podman:
sudo yum -y remove podman
https://github.com/containers/libpod/issues/4791

然后您可以安装Docker:
sudo dnf install docker-ce --nobest -y

sudo systemctl daemon-reload
sudo systemctl start docker
sudo systemctl enable docker

答案 2 :(得分:2)

只需尝试重新安装docker,看看问题是否仍然存在:

sudo yum install docker 

然后service docker startdocker info

答案 3 :(得分:1)

我使用了Docker安装指南,并在尝试启动docker(未找到设备)时收到相同的错误,我必须卸载:

yum删除docker-ce-cli containerd.io

并使用以下命令重新安装:

curl -sSL https://get.docker.com/ | sh

像冠军一样