一、卸載舊版本linux
sudo apt-get remove docker docker-ce docker-engine docker.io
二、首次安裝,安裝鏡像倉庫docker
2.1 更新apt軟件包索引ubuntu
sudo apt-get update
2.2 添加docker官方GPG祕鑰bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
2.3 配置倉庫curl
vi /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
三、安裝docker-ce測試
3.1 更新版本url
sudo apt-get update
3.2 安裝spa
3.2.1 安裝最新版本.net
sudo apt-get install docker-ce
3.2.2 安裝指定版本3d
sudo apt-get install docker-ce=<VERSION>
》安裝 17.03.2~ce-0~ubuntu-xenial 版本
sudo apt-get install docker-ce=17.03.2~ce-0~ubuntu-xenial
可能出現的錯誤
此問題源於libltdl7版本太低,ubuntu16.04默認無更高版本。
下載:
wget http://launchpadlibrarian.net/236916213/libltdl7_2.4.6-0.1_amd64.deb
安裝:
sudo dpkg -i libltdl7_2.4.6-0.1_amd64.deb
再次安裝 =》 跳轉3.1
四、測試安裝
sudo docker run hello-world
就此安裝成功!!!