启动容器报错An error occurred trying to connect: Get http:///var/run/docker.sock/v1.21/containers/json?all

网上查资料三步解决:

  1. Stop docker daemon
  2. sudo rm /var/lib/docker/network/files/local-kv.db
  3. Start docker daemon
但是没能解决我的问题。

在查看dockre状态时显示UUID有问题:

qian:/var/lib/docker/devicemapper/devicemapper # systemctl status docker -l
docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
   Active: failed (Result: exit-code) since Fri 2017-03-31 10:15:21 EDT; 45s ago
     Docs: http://docs.docker.com
  Process: 34204 ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS (code=exited, status=1/FAILURE)
 Main PID: 34204 (code=exited, status=1/FAILURE)

Mar 31 10:15:21 qian docker[34204]: time="2017-03-31T10:15:21.084102345-04: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."
Mar 31 10:15:21 qian docker[34204]: time="2017-03-31T10:15:21.098182020-04:00" level=error msg="[graphdriver] prior storage driver \"devicemapper\" failed: devmapper: Base Device UUID and Filesystem verification failed.devmapper: Current Base Device UUID: does not match with stored UUID:ecfee58a-4aef-41e5-888b-e1588b90f325. Possibly using a different thin pool than last invocation"
Mar 31 10:15:21 qian docker[34204]: time="2017-03-31T10:15:21.098304502-04:00" level=fatal msg="Error starting daemon: error initializing graphdriver: devmapper: Base Device UUID and Filesystem verification failed.devmapper: Current Base Device UUID: does not match with stored UUID:ecfee58a-4aef-41e5-888b-e1588b90f325. Possibly using a different thin pool than last invocation"

查看磁盘UUID发现比正常的容器少了个磁盘dm-0或者*

qian:/var/lib/docker/devicemapper/devicemapper # ls -al /dev/disk/by-uuid/
total 0
drwxr-xr-x 2 root root 100 Mar 30 19:13 .
drwxr-xr-x 5 root root 100 Mar 14 09:56 ..
lrwxrwxrwx 1 root root  10 Mar 14 09:56 ddaefbae-cc5e-4579-b2dc-24340323ccde -> ../../sda2
lrwxrwxrwx 1 root root  10 Mar 14 09:56 eabdb089-f65f-4150-ac14-7e2deaca1d85 -> ../../sda1
lrwxrwxrwx 1 root root  10 Mar 14 09:56 ecfee58a-4aef-41e5-888b-e1588b90f325 -> ../../sda3


查看容器的设备PID,发现和正常的也不一样,正常的是UUID,我的显示为PTUUID

qian:/var/lib/docker/devicemapper/devicemapper # blkid /dev/mapper/docker-8\:3-126130724-pool 
/dev/mapper/docker-8:3-126130724-pool: PTUUID="d541fadc" PTTYPE="dos" 

搞到这一步没法继续排查原因了,而且我可以明确和容器相关的磁盘UUID确实在我的节点上没有找到。

查看docker相关的uuid在/var/lib/docker/devicemapper/metadata/deviceset-metadata文件中。


最终我的解决方案是删除和docker有关的文件夹/etc/docker   /var/lib/docker  重装docker....




GitHub 加速计划 / js / json
41.72 K
6.61 K
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:1 个月前 )
960b763e 4 个月前
8c391e04 6 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐