Ubuntu安装旧版本Docker

mark

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

第一步:添加源

 1# 下面这个Docker的源
 2deb https://apt.dockerproject.org/repo ubuntu-xenial main
 3
 4deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
 5deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
 6deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
 7deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
 8deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
 9deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
10deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
11deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
12deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
13deb-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

第二步:添加秘钥

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

第三步:apt更新

1apt-get update

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

1apt-cache policy docker-engine

mark

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

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

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