«
Ubuntu Docker 安装
myluzh 发布于
阅读:331
Docker
0x01 卸载旧版本
# 卸载旧版本docker
sudo apt-get remove docker docker-engine docker.io containerd runc
0x02 设置仓库
# 更新 apt 包索引
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://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# 验证您现在是否拥有带有指纹的密钥
sudo apt-key fingerprint 0EBFCD88
# 设置稳定版仓库
sudo add-apt-repository \
"deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
$(lsb_release -cs) \
stable"
0x03 安装docker
# 更新apt包索引
sudo apt-get update
# 安装最新版本的Docker Engine-Community 和 containerd
sudo apt-get install docker-ce docker-ce-cli containerd.io
0x04 安装指定版本docker
# 仓库中列出可用版本,使用第二列中的版本字符串安装特定版本,例如 5:18.09.1~3-0~ubuntu-xenial。
apt-cache madison docker-ce
# 安装特定版本
sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
0x05 验证docker
docker -v
Docker version 27.0.3, build 7d4bcd8
ubuntu docker