Ubuntu 安装旧版本 Docker

mark

目前此操作方法不支持 Ubuntu18.04

第一步:添加源

1
2
3
4
5
6
7
8
9
10
11
12
13
# 下面这个 Docker 的源 
deb https://apt.dockerproject.org/repo ubuntu-xenial main

deb http://mirrors.aliyun.com/ubuntu/bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/bionic-backports main restricted universe multiverse

版本对应关系如下:

mark

所以在写的时候这样写就好了

Precise 12.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-precise main

Trusty 14.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-trusty main

Wily 15.10 deb https://apt.dockerproject.org/repo ubuntu-wily main

Xenial 16.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-xenial main

第二步:添加秘钥

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

第三步:apt 更新

1
apt-get update

第四步:查看可选的 Docker 版本

1
apt-cache policy docker-engine

mark

第五步:安装想要的版本的 Docker

1
apt install docker-engine=1.11.2-0~xenial

在这个网站查看支持的版本 https://apt.dockerproject.org/repo/dists/