情况描述

OS ubuntu 14.04

现象 apt-get install docker-ce的时候出现问题

root@sky:/mnt/sdb# sudo apt-get install docker-ce
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-image-3.13.0-110-generic linux-image-extra-3.13.0-110-generic
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  docker-ce
0 upgraded, 1 newly installed, 0 to remove and 380 not upgraded.
Need to get 19.1 MB of archives.
After this operation, 88.6 MB of additional disk space will be used.
Fetched 19.1 MB in 1min 48s (177 kB/s)                                                                                                                      
Selecting previously unselected package docker-ce.
(Reading database ... 78661 files and directories currently installed.)
Preparing to unpack .../docker-ce_17.03.0~ce-0~ubuntu-trusty_amd64.deb ...
Unpacking docker-ce (17.03.0~ce-0~ubuntu-trusty) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up docker-ce (17.03.0~ce-0~ubuntu-trusty) ...
Installing new version of config file /etc/bash_completion.d/docker ...
start: Job failed to start
invoke-rc.d: initscript docker, action "start" failed.
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)

原因分析:在安装完docker-ce后,docker服务启动失败。

打印fail的原因就是docker启动失败而打印。

为什么docker启动失败,估计是因为ubuntu上有老版的docker并没有删除干净。

处理方法:

1 删除

sudo apt-get purge docker-sudo apt-get install docker-cece

2 删除配置

sudo rm -rf /var/lib/docker

3 重装

sudo apt-get install docker-ce

4 测试效果

sudo docker run hello-world


参考:

https://docs.docker.com/engine/installation/linux/ubuntu/#install-from-a-package

附录结果情况

root@sky:/mnt/sdb# sudo apt-get install docker-ce -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
docker-ce is already the newest version.
The following packages were automatically installed and are no longer required:
  linux-image-3.13.0-110-generic linux-image-extra-3.13.0-110-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 380 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up docker-ce (17.03.0~ce-0~ubuntu-trusty) ...
start: Job failed to start
invoke-rc.d: initscript docker, action "start" failed.
dpkg: error processing package docker-ce (--configure):
 subprocess installed post-installation script returned error exit status 1
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@sky:/mnt/sdb# sudo apt-get purge docker-ce
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  aufs-tools git git-man liberror-perl libsystemd-journal0 linux-image-3.13.0-110-generic linux-image-extra-3.13.0-110-generic
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  docker-ce*
0 upgraded, 0 newly installed, 1 to remove and 380 not upgraded.
1 not fully installed or removed.
After this operation, 88.6 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 78864 files and directories currently installed.)
Removing docker-ce (17.03.0~ce-0~ubuntu-trusty) ...
Purging configuration files for docker-ce (17.03.0~ce-0~ubuntu-trusty) ...
Processing triggers for man-db (2.6.7.1-1) ...
root@sky:/mnt/sdb# sudo rm -rf /var/lib/docker
root@sky:/mnt/sdb# sudo apt-get install docker-ce 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-image-3.13.0-110-generic linux-image-extra-3.13.0-110-generic
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  docker-ce
0 upgraded, 1 newly installed, 0 to remove and 380 not upgraded.
Need to get 0 B/19.1 MB of archives.
After this operation, 88.6 MB of additional disk space will be used.
Selecting previously unselected package docker-ce.
(Reading database ... 78657 files and directories currently installed.)
Preparing to unpack .../docker-ce_17.03.0~ce-0~ubuntu-trusty_amd64.deb ...
Unpacking docker-ce (17.03.0~ce-0~ubuntu-trusty) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up docker-ce (17.03.0~ce-0~ubuntu-trusty) ...
docker start/running, process 26281
Processing triggers for ureadahead (0.100.0-16) ...
root@sky:/mnt/sdb# sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete 
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/


Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐