ubuntu18.04安装指定版本docker
删除docker相关组件
sudo apt-get autoremove docker docker-ce docker-engine docker.io containerd runc
更新apt-get
sudo apt-get update
安装 apt 依赖包,用于通过HTTPS来获取仓库
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
添加 Docker 的官方 GPG 密钥
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
设置稳定版仓库(18.04结果是添加到/etc/apt/sources.list中)
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
更新apt-get
sudo apt-get update
查看docker-ce版本
sudo apt-cache policy docker-ce
安装指定版本
sudo apt-get install docker-ce=5:19.03.0~3-0~ubuntu-bionic
设置开机自启动并启动 Docker-ce
systemctl start docker.service
systemctl enable docker.service
添加阿里云加速配置:
- 登录阿里开发者平台
https://promotion.aliyun.com/ntms/act/kubernetes.html#industry
- 点击“镜像搜索”
自动跳转到控制台的镜像搜索,在镜像加速下面找到如下配置,在机器上执行
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://yj9vlyz4.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker