在 Ubuntu 18.04 上升级到 18.09 后 Docker CE 无法启动

在 Ubuntu 18.04 上升级到 18.09 后 Docker CE 无法启动

当我尝试升级到 docker-ce 的最新版本 18.09.0~3-0~ubuntu-bionic 时,docker 无法启动,并出现找不到 devicemapper 插件的错误。

-- Unit docker.service has begun starting up.
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41-07:00" level=warning msg="Running experimental build"
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.149758139-07:00" level=info msg="User namespaces: ID ranges will be mapped to subuid/subgid ranges of: lxd:lxd"
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.159295190-07:00" level=info msg="systemd-resolved is running, so using resolvconf: /run/systemd/resolve/resolv.conf"
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.159453828-07:00" level=info msg="User namespaces: ID ranges will be mapped to subuid/subgid ranges of: lxd:lxd"
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160388092-07:00" level=info msg="parsed scheme: \"unix\"" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160423687-07:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160470021-07:00" level=info msg="parsed scheme: \"unix\"" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160482788-07:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160560969-07:00" level=info msg="ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0  <nil>}]" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160601454-07:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160588007-07:00" level=info msg="ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0  <nil>}]" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160697436-07:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160743537-07:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc4200db9f0, CONNECTING" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160691768-07:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc42009a1d0, CONNECTING" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160760682-07:00" level=warning msg="Unable to locate plugin: devicemapper, retrying in 1s"
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160773855-07:00" level=info msg="blockingPicker: the picked transport is not ready, loop back to repick" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160922445-07:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc42009a1d0, READY" module=grpc
Nov 18 22:16:41 server dockerd[6351]: time="2018-11-18T22:16:41.160999752-07:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc4200db9f0, READY" module=grpc
Nov 18 22:16:42 server dockerd[6351]: time="2018-11-18T22:16:42.161035546-07:00" level=warning msg="Unable to locate plugin: devicemapper, retrying in 2s"
Nov 18 22:16:44 server dockerd[6351]: time="2018-11-18T22:16:44.161383150-07:00" level=warning msg="Unable to locate plugin: devicemapper, retrying in 4s"
Nov 18 22:16:48 server dockerd[6351]: time="2018-11-18T22:16:48.161695623-07:00" level=warning msg="Unable to locate plugin: devicemapper, retrying in 8s"

升级前一切都运行良好。当我恢复到 docker-ce 的先前版本 18.06.1~ce~3-0~ubuntu 时,它又可以正常工作了。任何想法都很好。

守护进程.json:

{
    "userns-remap": "lxd",
    "userland-proxy": false,
    "storage-driver": "devicemapper",
    "storage-opts": [
      "dm.thinpooldev=/dev/mapper/docker-thinpool",
      "dm.use_deferred_removal=true",
      "dm.use_deferred_deletion=true"
    ]
}

名称:

Linux server 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

使用 Ubuntu 18.04.1 LTS

感谢您花时间查看此内容。

答案1

已弃用的 devicemapper 已从 Ubuntu docker 包中删除由于代码移至 containerd

在这个问题被修复之前,我建议将软件包固定到 18.06 版本。

cat > /etc/apt/preferences.d/docker  <<EOF
Package: docker-ce
Pin: version 18.06*
Pin-Priority: 1000
EOF

apt-get remove docker-ce runc docker containerd.io
apt-get install docker-ce thin-provisioning-tools
journalctl -xe | grep docker

答案2

删除我的存储选择和存储驱动程序配置后,我就能启动dockerd了。

根据@Ivan 链接中的信息,我删除了 docker-ce 并执行了autoremove。然后我重新安装了 docker-ce。安装后触发器尝试启动 dockerd,但失败了,但安装过程提供了journalctl -xe诊断问题的命令。

运行journalctl -xe显示错误消息,这让我怀疑是devicemapper。删除配置后dockerd可以正常启动。

相关内容