刚刚尝试在我的 Ubuntu 16.04 上安装 docker,出现以下错误。有什么建议可以解决哪里出了问题以及如何修复吗?
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 Fri 2017-07-28 12:39:11 CEST; 9ms ago
Docs: https://docs.docker.com
Process: 15533 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
Main PID: 15533 (code=exited, status=1/FAILURE)
Jul 28 12:39:11 jonas-X555LAB systemd[1]: Failed to start Docker Application Container Engine.
Jul 28 12:39:11 jonas-X555LAB systemd[1]: docker.service: Unit entered failed state.
Jul 28 12:39:11 jonas-X555LAB 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
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
我遵循了以下指南: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
$ sudo apt-cache policy docker-ce
docker-ce:
Installed: 17.06.0~ce-0~ubuntu
Candidate: 17.06.0~ce-0~ubuntu
Version table:
*** 17.06.0~ce-0~ubuntu 500
500 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
500 https://download.docker.com/linux/ubuntu xenial/edge amd64 Packages
100 /var/lib/dpkg/status
17.05.0~ce-0~ubuntu-xenial 500
500 https://download.docker.com/linux/ubuntu xenial/edge amd64 Packages
17.04.0~ce-0~ubuntu-xenial 500
500 https://download.docker.com/linux/ubuntu xenial/edge amd64 Packages
17.03.2~ce-0~ubuntu-xenial 500
500 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
17.03.1~ce-0~ubuntu-xenial 500
500 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
17.03.0~ce-0~ubuntu-xenial 500
500 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
$ sudo apt-get install -y docker-ce
在同一台机器上,我安装了 Linux Mint 17.3,docker 运行良好。使用与 LM17.3 上之前相同的主目录。
以下是一些规格:
$ inxi -fs
CPU: Dual core Intel Core i3-4005U (-HT-MCP-) cache: 3072 KB
clock speeds: max: 1600 MHz 1: 799 MHz 2: 799 MHz 3: 799 MHz 4: 799 MHz
CPU Flags: abm acpi aes aperfmperf apic arat arch_perfmon avx avx2 bmi1 bmi2 bts clflush cmov
constant_tsc cx16 cx8 de ds_cpl dtes64 dtherm dts epb ept erms est f16c flexpriority fma fpu fsgsbase
fxsr ht invpcid lahf_lm lm mca mce mmx monitor movbe msr mtrr nonstop_tsc nopl nx pae pat pbe pcid
pclmulqdq pdcm pdpe1gb pebs pge pln pni popcnt pse pse36 pts rdrand rdtscp rep_good sdbg sep smep ss
sse sse2 sse4_1 sse4_2 ssse3 syscall tm tm2 tpr_shadow tsc tsc_adjust tsc_deadline_timer vme vmx vnmi
vpid xsave xsaveopt xtopology xtpr
Sensors: System Temperatures: cpu: 40.5C mobo: N/A
Fan Speeds (in rpm): cpu: 2800
答案1
您好,您可能想使用它journalctl
来确切查看到底出了什么问题。
使用方式如下:
# journalctl -u docker.service
查看日志并查看到底出了什么问题。
提示:使用--since
标志来过滤您的搜索。
有关详细信息,journalctl
请参阅这一页。
答案2
基于此链接我使用了以下步骤
擦除/var/lib/docker(rm -rf /var/lib/docker)这将删除所有现有的容器和图像。
编辑 /etc/default/docker 文件并添加选项:DOCKER_OPTS="-s overlay"
然后
systemctl restart docker.service
答案3
现在它能正常工作了。看来 docker-ce 一直都已安装,只是因为我尝试再次安装它而失败了。很奇怪。通常,如果您尝试安装已安装的软件包,您会得到如下信息:
$ sudo apt install mypackage
Reading package lists... Done
Building dependency tree
Reading state information... Done
mypackage is already the newest version (5.7.19-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 27 not upgraded.
也许问题在于我根据所遵循的不同教程向 /etc/apt/sources.list 添加了不同的存储库。令人尴尬的是,我没有注意到该服务一直在后台运行并且运行良好。:/
答案4
我可以解决我的问题这解决方案。对我来说,问题是使用 VPN 连接会更改网关地址。当我断开 VPN 连接时,问题就解决了。请记住
sudo systemctl start docker
在断开 VPN 连接后运行