sudo apt-get update sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get -y update sudo apt-get -y install docker-ce
#apt-cache madison docker-ce
#docker-ce | 17.03.1ce-0ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
#docker-ce | 17.03.0ce-0ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
(VERSION例如上面的17.03.1ce-0ubuntu-xenial)
查询可用的版本
sudo apt-cache madison docker-ce
选择版本安装docker:
sudo apt-get install docker-ce=18.06.1ce3-0~ubuntu
安装后启动docker:
sudo service start docker
验证docker启动成功:
sudo docker run hello-world
返回:Hello from Docker!