CentOS7 启动docker.service失败

mariohi
  • 18

Hi all:
在CentOS7上执行yum install docker安装docker后,对docker进行测试出现如下错误:

[root@localhost /]# docker run -i -t ubuntu /bin/bash
2014/11/27 15:21:52 Post http:///var/run/docker.sock/v1.14/containers/create: read unix /var/run/docker.sock: connection reset by peer

搜索后得知是没有启动docker服务,执行启动服务失败:

[root@localhost /]# systemctl start docker.service
Job for docker.service failed. See 'systemctl status docker.service' and 'journalctl -xn' for details.
[root@localhost /]# systemctl status docker.service
docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
   Active: failed (Result: start-limit) since Thu 2014-11-27 15:03:24 CST; 13s ago
     Docs: http://docs.docker.io
  Process: 4559 ExecStart=/usr/bin/docker -d $OPTIONS $DOCKER_STORAGE_OPTIONS (code=exited, status=1/FAILURE)
 Main PID: 4559 (code=exited, status=1/FAILURE)

Nov 27 15:03:24 localhost.localdomain systemd[1]: docker.service: main proces...
Nov 27 15:03:24 localhost.localdomain systemd[1]: Failed to start Docker Appl...
Nov 27 15:03:24 localhost.localdomain systemd[1]: Unit docker.service entered...
Nov 27 15:03:24 localhost.localdomain systemd[1]: docker.service holdoff time...
Nov 27 15:03:24 localhost.localdomain systemd[1]: Stopping Docker Application...
Nov 27 15:03:24 localhost.localdomain systemd[1]: Starting Docker Application...
Nov 27 15:03:24 localhost.localdomain systemd[1]: docker.service start reques...
Nov 27 15:03:24 localhost.localdomain systemd[1]: Failed to start Docker Appl...
Nov 27 15:03:24 localhost.localdomain systemd[1]: Unit docker.service entered...
Hint: Some lines were ellipsized, use -l to show in full.

请问是什么问题???

回复
阅读 74.8k
10 个回答

如果是配置了国内镜像,并且镜像文件为/etc/docker/daemon.json,则修改文件后缀为.conf即可正常启动docker 服务

我的是因为修改了镜像加速导致类似错误无法启动 /etc/docker/daemon.conf后面多了个逗号 {"registry-mirrors": ["http://34df6785.m.daocloud.io"],} 去掉就可以了。供大家参考

0MOoN0
  • 2
新手上路,请多包涵

更新yum后重启再重新安装试下,我是这样解决的

yum update
yum install docker
systemctl start docker
codema
  • 1
新手上路,请多包涵

You need to install device-mapper-event-libs and then it works. Just do sudo yum install device-mapper-event-libs after you install docker.

yum install device-mapper-event-libs

安装 device-mapper-event-libs

启动的时候 sudo systemctl start docker 可以么?

到/var/run把docker.pid删掉重启可以么

貌似我之前修改了/etc/selinux/config,把SELINUX=enforcing改成了SELINUX=disabled。改回去就可以了

我用命令:

systemctl status docker.service

看到下面的信息中:

May 18 07:43:35 design systemd[1]: Starting Docker Application Container Engine...
May 18 07:43:35 design dockerd[1405]: time="2017-05-18T07:43:35.784525081Z" level=info msg="libcontainerd: new containerd process, pid: 1409"
May 18 07:43:36 design dockerd[1405]: time="2017-05-18T07:43:36.788556785Z" level=fatal msg="Your Linux kernel version 2.6.32-042stab116.1 is not supported for running docker.....0 or newer."
May 18 07:43:36 design systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
May 18 07:43:36 design systemd[1]: Failed to start Docker Application Container Engine.
May 18 07:43:36 design systemd[1]: Unit docker.service entered failed state.
May 18 07:43:36 design systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

第三行这样的:

Your Linux kernel version 2.6.32-042stab116.1 is not supported for running docker

崩溃,装的是centos7 ,可是还是不支持docker。。。。

李保成
  • 2
新手上路,请多包涵

我现在/etc/yum.repos.d/docker.repo 配置了阿里镜像(刚安装docker时配置的),后来配置阿里云docker库时,在/etc/docker/daemon.conf又配置了个镜像地址,导致两个镜像地址冲突。删除/etc/docker/daemon.conf里的配置即可。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
你知道吗?

宣传栏