这里给出我的安装配置过程,使用阿里源安装。
1.卸载旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
如果存在旧版本,我们需要使用该命令卸载它,不存在也没有关系,只是会报告没有安装这些软件包。
2.安装一些必要的系统工具
sudo apt-get update #获取软件最新源
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
3.安装GPG证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
4.写入软件源信息
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
5.更新并安装docker引擎
sudo apt-get -y update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io
如果需要安装特定的docker版本,可以参照官网。
6.测试是否安装成功
sudo docker run hello-world
如上则说明安装成功。