docker安装固定版本20.10 k8s 1.23.17兼容版本

Ubuntu 2204(apt)

先卸载旧版本:

c 复制代码
apt remove -y docker docker-engine docker.io containerd runc

安装依赖:

c 复制代码
apt update
apt install -y ca-certificates curl gnupg lsb-release

导入官方 GPG key:

c 复制代码
mkdir -p /etc/apt/keyrings
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

添加官方仓库:

c 复制代码
echo  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

更新索引:

c 复制代码
apt update

查看可安装的 20.10 版本:

c 复制代码
apt-cache madison docker-ce

安装(示例):

c 复制代码
apt install -y \
  docker-ce=5:20.10.24~3-0~ubuntu-$(lsb_release -cs) \
  docker-ce-cli=5:20.10.24~3-0~ubuntu-$(lsb_release -cs) \
  containerd.io

启动:

c 复制代码
systemctl enable docker
systemctl restart docker
docker version

CentOS / Rocky / Alma(yum)

删除旧版本:

c 复制代码
yum remove -y docker \
  docker-client \
  docker-client-latest \
  docker-common \
  docker-latest \
  docker-latest-logrotate \
  docker-logrotate \
  docker-engine

安装工具:

c 复制代码
yum install -y yum-utils

添加官方仓库:

c 复制代码
yum-config-manager \
  --add-repo \
  https://download.docker.com/linux/centos/docker-ce.repo

查看 20.10:

c 复制代码
yum list docker-ce --showduplicates | grep 20.10

安装:

c 复制代码
yum install -y \
  docker-ce-20.10.24 \
  docker-ce-cli-20.10.24 \
  containerd.io

启动:

c 复制代码
systemctl enable docker
systemctl restart docker
docker version

二进制文件下载链接

c 复制代码
https://download.docker.com/linux/static/stable/

https://download.docker.com/linux/static/stable/x86_64/docker-20.10.24.tgz

官方脚本

c 复制代码
curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh

GPG 添加命令

c 复制代码
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg	

Ubuntu 所有版本安装命令速查表

c 复制代码
下表汇总了 Ubuntu 各主要版本的 Docker 20.10.x 安装命令,需要将 VERSION_STRING 替换为要安装的具体版号(如 5:20.10.24~3-0~ubuntu-jammy):

版本代号	Ubuntu 版本号		软件源添加命令
Jammy	22.04 (LTS)  echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null	sudo apt-get update 

Focal	20.04 (LTS)	 echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null	

Bionic	18.04 (LTS)	 echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu bionic stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null	

Xenial	16.04 (LTS)	 echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu xenial stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

安装命令

c 复制代码
sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin
相关推荐
曲幽17 小时前
别再用网页翻译看源码了!你的私人翻译神器LibreTranslate,部署避坑指南来了
python·docker·web·pot·translate·libretranslate·arogstranslate
武子康3 天前
调查研究-183 Apple container:Mac 上用轻量 VM 跑 Linux 容器,Swift 会改写本地容器体验吗?
docker·容器·apple
Alsn866 天前
等待学习-学习目录:Docker 容器安全攻防
学习·安全·docker
2601_961875246 天前
决战申论100题2026|最新|范文
linux·容器·centos·debian·ssh·fabric·vagrant
java_cj6 天前
深入kube-apiserver认证机制:从Bearer Token到mTLS的完整认证链解析
linux·运维·服务器·云原生·容器·kubernetes
程序员老赵6 天前
服务器没有桌面?Docker 跑个 Chrome,浏览器就能远程用
docker·容器·devops
杨浦老苏6 天前
轻量级Docker仪表板Servedash
运维·docker·监控·群晖·仪表板
正经教主6 天前
【docker基础】 第八周:容器监控与应用更新策略
运维·docker·容器
kiros_wang6 天前
Docker 使用完整指南
运维·docker·容器
正经教主6 天前
【docker基础】第九周:Docker安全与镜像优化
运维·docker·容器