无法在 Ubuntu 17.10 上安装 docker

无法在 Ubuntu 17.10 上安装 docker

我有:Ubuntu 17.10-内核4.13.0-19-generic

机器上没有docker

安装 dockerhttps://github.com/docker/docker-install, IE :

curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh

我明白了

$ docker -v
Docker version 17.11.0-ce, build 1caf76c

很好,当我运行 $ sudo docked 时,我得到了

ERRO[2017-12-15T17:33:21.314578657+01:00] 未在此主机上找到受支持的文件系统“overlay”。请确保内核足够新并且已加载覆盖支持。

ERRO[2017-12-15T17:33:21.316522224+01:00] 未在此主机上找到受支持的文件系统“overlay”。请确保内核足够新并且已加载覆盖支持。启动守护进程时出错:初始化 graphdriver 时出错:devicemapper:

运行 deviceCreate (CreatePool) 时出错,dm_task_run 失败

我再试一次,这次

ERRO[2017-12-15T17:35:24.814595903+01:00] [graphdriver] 先前的存储驱动程序 devicemapper 失败:devicemapper:运行 deviceCreate(CreatePool)dm_task_run 时出错,失败

启动守护进程时出错:初始化 graphdriver 时出错:devicemapper:运行 deviceCreate (CreatePool) 时出错,dm_task_run 失败

怎么了 ?

答案1

我已经在 Virtualbox 中安装了带有 Ubuntu 17.10 的新 VM,并且使用 apt 更新了软件包。

当前内核版本:

$ uname -a
Linux test-VirtualBox 4.13.0-19-generic #22-Ubuntu SMP Mon Dec 4 11:58:07 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

我使用您建议的脚本安装 Docker:

apt-get install curl -y
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh

我将我的用户帐户添加到 docker 组:

sudo usermod -aG docker test

我注销并再次登录,以便我的群组成员身份得到更新。

我检查了 docker CLI 版本:

docker version
Client:
 Version:      17.11.0-ce
 API version:  1.34
 Go version:   go1.8.5
 Git commit:   1caf76c
 Built:        Mon Nov 20 18:36:39 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.11.0-ce
 API version:  1.34 (minimum version 1.12)
 Go version:   go1.8.5
 Git commit:   1caf76c
 Built:        Mon Nov 20 18:35:09 2017
 OS/Arch:      linux/amd64
 Experimental: false

Docker 17.11 CE(edge)已安装。

我启动 docker 守护进程并启用它:

$ sudo systemctl status docker
$ sudo systemctl enable docker

我检查docker守护进程运行良好

$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2017-12-18 20:37:32 CET; 4min 35s ago
     Docs: https://docs.docker.com
 Main PID: 2028 (dockerd)
    Tasks: 18 (limit: 4915)
   Memory: 35.7M
      CPU: 2.641s
   CGroup: /system.slice/docker.service
           ├─2028 /usr/bin/dockerd -H fd://
           └─2033 docker-containerd --config /var/run/docker/containerd/containerd.toml

dic 18 20:37:29 test-VirtualBox dockerd[2028]: time="2017-12-18T20:37:29.670548640+01:00" level=warning msg="Your kernel does not support swap memory limit"
dic 18 20:37:29 test-VirtualBox dockerd[2028]: time="2017-12-18T20:37:29.674459227+01:00" level=warning msg="Your kernel does not support cgroup rt period"
dic 18 20:37:29 test-VirtualBox dockerd[2028]: time="2017-12-18T20:37:29.674701645+01:00" level=warning msg="Your kernel does not support cgroup rt runtime"
dic 18 20:37:29 test-VirtualBox dockerd[2028]: time="2017-12-18T20:37:29.680586963+01:00" level=info msg="Loading containers: start."
dic 18 20:37:30 test-VirtualBox dockerd[2028]: time="2017-12-18T20:37:30.678377763+01:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0
dic 18 20:37:31 test-VirtualBox dockerd[2028]: time="2017-12-18T20:37:31.543493214+01:00" level=info msg="Loading containers: done."
dic 18 20:37:31 test-VirtualBox dockerd[2028]: time="2017-12-18T20:37:31.869113420+01:00" level=info msg="Docker daemon" commit=1caf76c graphdriver(s)=overlay2 version=17
dic 18 20:37:31 test-VirtualBox dockerd[2028]: time="2017-12-18T20:37:31.873009943+01:00" level=info msg="Daemon has completed initialization"
dic 18 20:37:32 test-VirtualBox systemd[1]: Started Docker Application Container Engine.
dic 18 20:37:32 test-VirtualBox dockerd[2028]: time="2017-12-18T20:37:32.192666262+01:00" level=info msg="API listen on /var/run/docker.sock"

Docker 守护进程使用 overlay2 作为存储驱动程序。

$ docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 17.11.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs

覆盖模块已加载:

lsmod | grep overlay
overlay                69632  0

我重新启动了服务器并检查docker已经启动正常并且我可以启动一个hello-world容器:

$ docker run hello-world
...
Hello from Docker!

一切看起来都很好!因此,我建议您使用 systemctl 启动 docker 守护进程,而不是从 shell 使用 dockerd 启动它。

相关内容