码头工人无法启动

时间:2019-07-31 03:02:03

标签: docker docker-ce

我想安装docker-ce,但无法启动

我以这种方式安装docker-ce:

sudo yum install docker-ce

我的系统类型:

Linux version 3.10.107-1-tlinux2_kvm_guest-0046 (root@TENCENT64.site) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Wed Dec 27 10:57:04 CST 2017

docker版本:

docker version
Client:
 Version:           18.09.7
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        2d0083d
 Built:             Thu Jun 27 17:56:06 2019
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

错误信息详细信息:

systemctl status docker.service
* docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/docker.service.d
           `-override.conf
   Active: failed (Result: start-limit) since Wed 2019-07-31 10:12:15 CST; 921ms ago
     Docs: https://docs.docker.com
  Process: 15961 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 15961 (code=exited, status=1/FAILURE)

Jul 31 10:12:13 TENCENT64.site systemd[1]: Failed to start Docker Application Container Engine.
Jul 31 10:12:13 TENCENT64.site systemd[1]: Unit docker.service entered failed state.
Jul 31 10:12:13 TENCENT64.site systemd[1]: docker.service failed.
Jul 31 10:12:15 TENCENT64.site systemd[1]: docker.service holdoff time over, scheduling restart.
Jul 31 10:12:15 TENCENT64.site systemd[1]: Stopped Docker Application Container Engine.
Jul 31 10:12:15 TENCENT64.site systemd[1]: start request repeated too quickly for docker.service
Jul 31 10:12:15 TENCENT64.site systemd[1]: Failed to start Docker Application Container Engine.
Jul 31 10:12:15 TENCENT64.site systemd[1]: Unit docker.service entered failed state.
Jul 31 10:12:15 TENCENT64.site systemd[1]: docker.service failed.
journalctl -xe
Jul 31 10:12:13 TENCENT64.site systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.
-- 
-- The result is failed.
Jul 31 10:12:13 TENCENT64.site systemd[1]: Unit docker.service entered failed state.
Jul 31 10:12:13 TENCENT64.site systemd[1]: docker.service failed.
Jul 31 10:12:15 TENCENT64.site systemd[1]: docker.service holdoff time over, scheduling restart.
Jul 31 10:12:15 TENCENT64.site systemd[1]: Stopped Docker Application Container Engine.
-- Subject: Unit docker.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has finished shutting down.
Jul 31 10:12:15 TENCENT64.site systemd[1]: Closed Docker Socket for the API.
-- Subject: Unit docker.socket has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has finished shutting down.
Jul 31 10:12:15 TENCENT64.site systemd[1]: Stopping Docker Socket for the API.
-- Subject: Unit docker.socket has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has begun shutting down.
Jul 31 10:12:15 TENCENT64.site systemd[1]: Starting Docker Socket for the API.
-- Subject: Unit docker.socket has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has begun starting up.
Jul 31 10:12:15 TENCENT64.site systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has finished starting up.
-- 
-- The start-up result is done.
Jul 31 10:12:15 TENCENT64.site systemd[1]: start request repeated too quickly for docker.service
Jul 31 10:12:15 TENCENT64.site systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.
-- 
-- The result is failed.
Jul 31 10:12:15 TENCENT64.site systemd[1]: Unit docker.service entered failed state.
Jul 31 10:12:15 TENCENT64.site systemd[1]: docker.service failed.

我的daemon.json(/etc/docker/daemon.json)不存在,当我创建一个内容为'{}'的daemon.json时,也报错

我尝试了一些方法:

  1. 清除/ var / lib / docker
  2. 重新安装docker-ce

docker的旧版本docker和docker-io是正常的,但是没有ip和端口映射,所以我现在使用docker-ce。

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

可以使用两种不同的方法启动Docker:

  1. 通过systemctl,这是推荐的方式
  2. 直接通过docker daemon bin:dockerd,这不是推荐的方式

但是,当您直接启动docker守护程序时(即不使用systemctl),systemctl无法知道守护程序的当前状态。

所以我的猜测是,在安装后,docker守护程序以某种方式部分启动并失败。
要检查是否是这种情况,只需运行:

sudo ps -aux | grep dockerd

然后杀死附加到docker守护程序的所有进程。
完成后,您应该可以直接通过systemctl启动docker。