准备
安装系统必要软件
1 | $ sudo apt-get update |
添加安装docker engine的镜像源
查看操作系统版本
执行命令 lsb_release -a
1
2
3
4
5No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
创建镜像源文件
创建docker.list文件,文件路径 /etc/apt/sources.list.d/docker.list
,根据操作系统的版本,来选择相关的镜像源头1
2
3
4
5
6
7
8On Ubuntu Precise 12.04 (LTS)
deb https://apt.dockerproject.org/repo ubuntu-precise main
On Ubuntu Trusty 14.04 (LTS)
deb https://apt.dockerproject.org/repo ubuntu-trusty main
Ubuntu Wily 15.10
deb https://apt.dockerproject.org/repo ubuntu-wily main
Ubuntu Xenial 16.04 (LTS)
deb https://apt.dockerproject.org/repo ubuntu-xenial main
Docker安装
- 更新
apt
包索引sudo apt-get update
- 安装
docker
sudo apt-get install docker-engine
- 安装docker指定版本
1
2sudo apt-cache showpkg docker-engine
apt-get install -y -q docker-engine=1.8.1-0~trusty