Ubuntu安装Docker步骤

环境:Ubuntu Trusty 14.04 (LTS)

前提条件:

Docker requires a 64-bit installation regardless of your Ubuntu version.

Additionally, your kernel must be 3.10 at minimum.

1.检查Linux系统内核。

$ uname -r

3.13.0-24-generic

2.更新系统源。

$ sudo apt-get update

3.更新Https和CA证书。

ensure that APT works with the https method, and that CA certificates are installed.

$ sudo apt-get install apt-transport-https ca-certificates

4.添加新的GPG Key。

$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

5.添加Docker源。

$ echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list

6.更新系统源。

$ sudo apt-get update

7.校验APT是否正在拉取争取的源。

Each entry should have the URL https://apt.dockerproject.org/repo/

$ apt-cache policy docker-engine

docker-engine:
Installed: 1.12.2-0~trusty
Candidate: 1.12.2-0~trusty
Version table:
*** 1.12.2-0~trusty 0
500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
100 /var/lib/dpkg/status
1.12.1-0~trusty 0
500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
1.12.0-0~trusty 0
500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
1.11.2-0~trusty 0
500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
1.11.1-0~trusty 0
500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages

8.安装linux-image-extra-*包。

$ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

9.更新系统源。

$ sudo apt-get update

10.安装Docker。

$ sudo apt-get install docker-engine

11.启动Docker Daemon。

$ sudo service docker start

12.校验Docker是否安装正确。

$ sudo docker run hello-world

This command downloads a test image and runs it in a container.

When the container runs, it prints an informational message. Then, it exits.

 

卸载步骤:

1. 卸载Docker package

$ sudo apt-get purge docker-engine

2.卸载Docker package以及依赖

$ sudo apt-get autoremove --purge docker-engine

3.删除所有相关的Image、Container和Volume

$ rm -rf /var/lib/docker

参考:https://docs.docker.com/engine/installation/linux/ubuntulinux/

posted @ 2016-11-15 20:20  Edisonxiang  阅读(1600)  评论(0编辑  收藏  举报