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
相关推荐
copyer_xyf3 小时前
Docker 入门与实战:容器化 React + NestJS 项目
docker
刘马想放假4 小时前
Docker 从入门到进阶:一篇写给工程师的系统化实战指南
运维·docker·容器
zjun30215 小时前
如何搭建TRAE IDE 连接到容器开发环境
docker·容器·ascend·trae
寒冰碧海5 小时前
大模型部署从0到1(一):通用环境全流程准备|NVIDIA驱动+Docker+NVIDIA Container Toolkit
运维·docker·容器
hj2862515 小时前
K8S 核心组件与资源概念 + 带注释命令 + 实操案例版笔记
笔记·容器·kubernetes
nece0016 小时前
Kubernetes v1.36.0 + Ubuntu24.04 + containerd 2.x WordPress 完整部署文档
云原生·容器·kubernetes
hdsoft_huge7 小时前
SpringBoot 系列 20:Jar 打包 + Docker 容器化 + Compose 一键部署|服务器上线 & 零停机平滑升级全教程
spring boot·docker·jar
你想考研啊7 小时前
七、Docker 容器 + Docker Compose单机部署理发店系统
docker·容器·composer
梦梦代码精7 小时前
BuildingAI:企业级开源智能体搭建平台的破局者
前端·docker·架构·开源·代码规范
未来可期丶9 小时前
【开发环境】Windows+Docker Desktop+WSL2最佳实践
windows·docker·docker desktop·wsl2