一、卸载旧版本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
就此安装成功!!!