1. 更新apt库
apt-get update
2. 安装以下软件包,使apt可以通过https使用存储库
apt-get install apt-transport-https ca-certificates url software-properties-common
3. 添加docker官方的软件包密钥(GPG)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg |apt-key add -
4. 设置stable库
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
5.更新apt库
apt-get update
6.安装最新版docker-ce
apt-get install docker-ce
apt-cache madison docker-ce //列出可用的 docker-ce版本
apt-get install docker-ce=< x> // 安装指定版本的docker-ce
7.查看服务启动状态
systemctl status docker