尝试将 Docker 安装到在 Ubuntu 16.04 上工作的 VirtualBox 来宾 - 它不起作用。
我遵循安装指南https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-repository:
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
...
done.
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
$ sudo apt-key fingerprint 0EBFCD88
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <[email protected]>
sub 4096R/F273FCD8 2017-02-22
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get update
...
Reading package lists... Done
然后我尝试安装 docker-ce 并得到错误:
$ sudo apt-get install docker-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
docker-ce
0 upgraded, 1 newly installed, 0 to remove and 121 not upgraded.
Need to get 0 B/40.0 MB of archives.
After this operation, 198 MB of additional disk space will be used.
Selecting previously unselected package docker-ce.
(Reading database ... 72543 files and directories currently installed.)
Preparing to unpack .../docker-ce_18.06.1~ce~3-0~ubuntu_amd64.deb ...
Unpacking docker-ce (18.06.1~ce~3-0~ubuntu) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21.1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up docker-ce (18.06.1~ce~3-0~ubuntu) ...
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2018-09-26 11:35:03 +05; 4ms ago
Docs: https://docs.docker.com
Process: 17078 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
Main PID: 17078 (code=exited, status=1/FAILURE)
Sep 26 11:35:03 build-server systemd[1]: Failed to start Docker Application Container Engine.
Sep 26 11:35:03 build-server systemd[1]: docker.service: Unit entered failed state.
Sep 26 11:35:03 build-server systemd[1]: docker.service: Failed with result 'exit-code'.
dpkg: error processing package docker-ce (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
以下是建议在之前的命令输出中查看的调试信息:
$ systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Wed 2018-09-26 11:35:04 +05; 1min 20s ago
Docs: https://docs.docker.com
Process: 17200 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
Main PID: 17200 (code=exited, status=1/FAILURE)
Sep 26 11:35:04 build-server systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Sep 26 11:35:04 build-server systemd[1]: Failed to start Docker Application Container Engine.
Sep 26 11:35:04 build-server systemd[1]: docker.service: Unit entered failed state.
Sep 26 11:35:04 build-server systemd[1]: docker.service: Failed with result 'exit-code'.
Sep 26 11:35:04 build-server systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Sep 26 11:35:04 build-server systemd[1]: Stopped Docker Application Container Engine.
Sep 26 11:35:04 build-server systemd[1]: docker.service: Start request repeated too quickly.
Sep 26 11:35:04 build-server systemd[1]: Failed to start Docker Application Container Engine.
还有一个:
$ journalctl -xe
...
-- The start-up result is done.
Sep 26 11:35:04 build-server systemd[1]: docker.service: Start request repeated too quickly.
Sep 26 11:35:04 build-server systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
...
我也尝试在调试模式下运行 Docker,这里是输出:
$ sudo dockerd -D
...
ERRO[2018-09-26T11:39:15.551563104+05:00] [graphdriver] prior storage driver devicemapper failed: devicemapper: Error running deviceCreate (CreatePool) dm_task_run failed
...
谷歌搜索不到任何有用的东西。有什么建议么?提前致谢。
更新到最新的 Point-Release 或 LTS 启用堆栈
有一些问题是指与旧内核版本不兼容。还有一个帖子,通过更新到最新的点版本来解决类似的问题。
我会尝试最新的LTS 启用堆栈。
不同的存储驱动程序
一个快速修复可能是从设备映射器更改为这里描述的overlayfs (或其他一些fs,例如aufs)。编辑
/etc/docker/daemon.json
文件并更改存储驱动程序:该存储驱动程序还有更多选项。