Docker无法启动

时间:2017-08-28 07:14:20

标签: docker

我使用命令

在centos机器上使用命令安装了docker

- > yum install docker

 docker --version -> Docker version 1.12.6, build 88a4867/1.12.6

当我使用命令启动docker时 - >服务码头启动

Redirecting to /bin/systemctl start  docker.service
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 -l docker.service ●

docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2017-08-27 23:30:54 PDT; 39s ago
     Docs: http://docs.docker.com
  Process: 21772 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
 Main PID: 21772 (code=exited, status=1/FAILURE)

Aug 27 23:30:53 tintserver7200 systemd[1]: Starting Docker Application Container Engine...
Aug 27 23:30:53 tintserver7200 dockerd-current[21772]: time="2017-08-27T23:30:53.373296685-07:00" level=info msg="libcontainerd: new containerd process, pid: 21780"
Aug 27 23:30:54 tintserver7200 dockerd-current[21772]: time="2017-08-27T23:30:54.386669163-07:00" level=warning msg="devmapper: Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man docker` to refer to dm.thinpooldev section."
Aug 27 23:30:54 tintserver7200 dockerd-current[21772]: time="2017-08-27T23:30:54.387270412-07:00" level=error msg="[graphdriver] prior storage driver \"devicemapper\" failed: devmapper: Base Device UUID and Filesystem verification failed: devicemapper: Can't set cookie dm_task_set_cookie failed"
Aug 27 23:30:54 tintserver7200 dockerd-current[21772]: time="2017-08-27T23:30:54.388221829-07:00" level=fatal msg="Error starting daemon: error initializing graphdriver: devmapper: Base Device UUID and Filesystem verification failed: devicemapper: Can't set cookie dm_task_set_cookie failed"
Aug 27 23:30:54 tintserver7200 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Aug 27 23:30:54 tintserver7200 systemd[1]: Failed to start Docker Application Container Engine.
Aug 27 23:30:54 tintserver7200 systemd[1]: Unit docker.service entered failed state.
Aug 27 23:30:54 tintserver7200 systemd[1]: docker.service failed.

- > uname -a Linux tintserver7200 3.10.0-514.6.1.el7.x86_64#1 SMP Wed 1月18日13:06:36 UTC 2017 x86_64 x86_64 x86_64 GNU / Linux

sudo docker daemon -D

DEBU[0000] docker group found. gid: 386
DEBU[0000] Listener created for HTTP on unix (/var/run/docker.sock)
INFO[0000] libcontainerd: new containerd process, pid: 32755
DEBU[0000] libcontainerd: containerd connection state change: CONNECTING
DEBU[0000] libcontainerd: containerd connection state change: TRANSIENT_FAILURE
WARN[0000] containerd: low RLIMIT_NOFILE changing to max  current=1024 max=4096
DEBU[0000] containerd: read past events                  count=0
DEBU[0000] containerd: supervisor running                cpus=4 memory=7713 runtime=docker-runc runtimeArgs=[] stateDir=/var/run/docker/libcontainerd/containerd
DEBU[0000] containerd: grpc api on /var/run/docker/libcontainerd/docker-containerd.sock
DEBU[0001] Using default logging driver json-file
DEBU[0001] Golang's threads limit set to 54630
DEBU[0001] devicemapper: driver version is 4.34.0
DEBU[0001] devmapper: Generated prefix: docker-253:0-582605
DEBU[0001] devmapper: Checking for existence of the pool docker-253:0-582605-pool
DEBU[0001] devmapper: Pool doesn't exist. Creating it.
ERRO[0001] [graphdriver] prior storage driver "devicemapper" failed: devicemapper: Can't set cookie dm_task_set_cookie failed
DEBU[0001] Cleaning up old mountid : start.
FATA[0001] Error starting daemon: error initializing graphdriver: devicemapper: Can't set cookie dm_task_set_cookie failed

2 个答案:

答案 0 :(得分:5)

修正了我的回应' y' | sudo dmsetup udevcomplete_all 它能够开始

答案 1 :(得分:0)

many others遇到此问题(或跳至下面的解决方案)以来,在此处澄清原始问题/答案:

这里的普遍问题是,较早版本的Docker可能在容器的装载空间之外有devicemapper个泄漏信号/ cookie。对我来说,这是在多次快速调用docker buildrunrmstop等之后发生的。

这可能导致系统的信号量数组填满而不被清除,这将阻止所有docker命令正常工作(并可能影响依赖于那些共享信号量的其他系统功能)。

您可以通过increasing the number of semaphore arrays或通过清除某些旧数组来解决此问题,如下所示。


可接受的答案将clearing all semaphoresdmsetup udevcomplete_all一起使用,但是如果您还有其他依赖于这些cookie /信号量的容器或进程,则可能不想这样做。

相反,请检查您的semaphore arrays-这些在我的机器上已满(128个阵列):

$ ipcs -u

------ Semaphore Status --------
used arrays = 128
allocated semaphores = 1136

------ Messages Status --------
allocated queues = 0
used headers = 0
used space = 0 bytes

------ Shared Memory Status --------
segments allocated 2
pages allocated 20057
pages resident  16214
pages swapped   2
Swap performance: 0 attempts     0 successes

这些信号量对应于dm cookie,如ipcsdmsetup udevcookies所示(仅显示最近的cookie;寻找匹配的semid):

$ ipcs -s -t
semid    owner      last-op                    last-changed              
540278908 root        Sat Jun 13 10:03:57 2020   Sat Jun 13 10:03:57 2020  
548634749 root        Sat Jun 13 10:09:22 2020   Sat Jun 13 10:09:22 2020  
555876478 root        Sat Jun 13 10:14:05 2020   Sat Jun 13 10:14:05 2020  
572096639 root        Sat Jun 13 11:43:42 2020   Sat Jun 13 11:43:42 2020 
...

$ dmsetup udevcookies
Cookie       Semid      Value      Last semop time           Last change time
0xd4d819c    540278908  1          Sat Jun 13 10:03:57 2020  Sat Jun 13 10:03:57 2020
0xd4d8d60    548634749  1          Sat Jun 13 10:09:22 2020  Sat Jun 13 10:09:22 2020
0xd4d8eca    555876478  1          Sat Jun 13 10:14:05 2020  Sat Jun 13 10:14:05 2020
0xd4d7263    572096639  1          Sat Jun 13 11:43:42 2020  Sat Jun 13 11:43:42 2020
...

为了避免影响较早的信号灯/ cookie,我只想使用msetup udevreleasecookie <cookie ID>释放特定日期的cookie:

# filter the list of cookies, get the IDs, and feed it to udevreleasecookie:

$ REGEX_STR="Jun 13"    # change to whatever filter you need
$ dmsetup udevcookies | grep -E "$REGEX_STR" | awk '{ print $1 }' | xargs -n1 dmsetup udevreleasecookie

# check that the semaphores are gone
$ ipcs -s -t | grep -E "root" | grep -E "$REGEX_STR"    
...
$

这使我能够再次运行docker命令。