Ubuntu20.04 LTS国内源安装指定版本Docker
1.卸载旧版本Docker
#卸载旧版本
apt-get autoremove docker docker-ce docker-engine docker.io containerd runc
#清空旧版docker占用的内存
sudo apt-get remove --auto-remove docker
# 删除无用的相关的配置文件
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
#删除相关目录
rm -rf /etc/systemd/system/docker.service.d
rm -rf /var/lib/docker
#更新系统源
sudo apt-get update
2.配置安装环境
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
3. 添加阿里云的docker GPG密钥
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
4. 添加阿里镜像源
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
#更新 sudo apt-get update
5. 查看有哪些版本
apt-cache madison docker-ce
apt-cache madison docker-ce-cli
6. 安装最新版/指定版本
#安装最新版
sudo apt-get install -y docker-ce
#安装5:20.10.21~3-0~ubuntu-kinetic版
sudo apt-get install -y docker-ce=5:20.10.21~3-0~ubuntu-kinetic docker-ce-cli=5:20.10.21~3-0~ubuntu-kinetic
7. 重启Docker
sudo service docker restart
#或者
sudo systemctl restart docker
8. 配置阿里容器镜像加速器
vim /etc/docker/daemon.json
#添加registry-mirrors
#使配置文件生效
sudo systemctl daemon-reload
sudo systemctl restart docker
#运行hello-world验证docker-ce是否安装成功
9. 运行hello-world验证docker是否安装成功
docker run hello-world
10. 设置docker开机自启
sudo systemctl enable docker
分类:
Java加班工作日记
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统