在RHEL 9.X上安装 Docker最新版(28.3.3)
前面是指南,后面是工作日志。
步骤 1:卸载旧版本
sudo dnf remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
步骤 2:添加 Docker CE 仓库
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
步骤 3:解决依赖冲突
由于 RHEL 9.4 的默认仓库与 Docker 仓库存在冲突,需排除部分包:
sudo dnf install docker-ce docker-ce-cli containerd.io --allowerasing -y
--allowerasing 允许替换冲突的依赖包(如 containerd.io 会替换系统自带的 runc)。
步骤 4:启动并启用服务
sudo systemctl enable --now docker
[root@bastion harbor]# sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use "rhc" or "subscription-manager" to register.
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
[root@bastion harbor]#
[root@bastion yum.repos.d]# sudo dnf install docker-ce docker-ce-cli containerd.io --allowerasing -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use "rhc" or "subscription-manager" to register.
Docker CE Stable - x86_64 46 kB/s | 78 kB 00:01
Dependencies resolved.
========================================================================================================================================================================
Package Architecture Version Repository Size
========================================================================================================================================================================
Installing:
containerd.io x86_64 1.7.27-3.1.el9 docker-ce-stable 44 M
docker-ce x86_64 3:28.3.3-1.el9 docker-ce-stable 21 M
docker-ce-cli x86_64 1:28.3.3-1.el9 docker-ce-stable 8.6 M
Installing weak dependencies:
docker-buildx-plugin x86_64 0.26.1-1.el9 docker-ce-stable 16 M
docker-ce-rootless-extras x86_64 28.3.3-1.el9 docker-ce-stable 3.4 M
docker-compose-plugin x86_64 2.39.1-1.el9 docker-ce-stable 15 M
Transaction Summary
========================================================================================================================================================================
Install 6 Packages
Total download size: 108 M
Installed size: 435 M
Downloading Packages:
(1/6): docker-buildx-plugin-0.26.1-1.el9.x86_64.rpm 1.0 MB/s | 16 MB 00:15
(2/6): docker-ce-cli-28.3.3-1.el9.x86_64.rpm 637 kB/s | 8.6 MB 00:13
(3/6): docker-ce-rootless-extras-28.3.3-1.el9.x86_64.rpm 490 kB/s | 3.4 MB 00:07
(4/6): docker-ce-28.3.3-1.el9.x86_64.rpm 545 kB/s | 21 MB 00:38
(5/6): containerd.io-1.7.27-3.1.el9.x86_64.rpm 1.0 MB/s | 44 MB 00:42
(6/6): docker-compose-plugin-2.39.1-1.el9.x86_64.rpm 1.6 MB/s | 15 MB 00:09
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 2.3 MB/s | 108 MB 00:46
Docker CE Stable - x86_64 3.0 kB/s | 1.6 kB 00:00
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) "
Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
From : https://download.docker.com/linux/centos/gpg
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : docker-buildx-plugin-0.26.1-1.el9.x86_64 1/6
Running scriptlet: docker-buildx-plugin-0.26.1-1.el9.x86_64 1/6
Installing : docker-compose-plugin-2.39.1-1.el9.x86_64 2/6
Running scriptlet: docker-compose-plugin-2.39.1-1.el9.x86_64 2/6
Installing : docker-ce-cli-1:28.3.3-1.el9.x86_64 3/6
Running scriptlet: docker-ce-cli-1:28.3.3-1.el9.x86_64 3/6
Installing : containerd.io-1.7.27-3.1.el9.x86_64 4/6
Running scriptlet: containerd.io-1.7.27-3.1.el9.x86_64 4/6
Installing : docker-ce-rootless-extras-28.3.3-1.el9.x86_64 5/6
Running scriptlet: docker-ce-rootless-extras-28.3.3-1.el9.x86_64 5/6
Installing : docker-ce-3:28.3.3-1.el9.x86_64 6/6
Running scriptlet: docker-ce-3:28.3.3-1.el9.x86_64 6/6
Verifying : containerd.io-1.7.27-3.1.el9.x86_64 1/6
Verifying : docker-buildx-plugin-0.26.1-1.el9.x86_64 2/6
Verifying : docker-ce-3:28.3.3-1.el9.x86_64 3/6
Verifying : docker-ce-cli-1:28.3.3-1.el9.x86_64 4/6
Verifying : docker-ce-rootless-extras-28.3.3-1.el9.x86_64 5/6
Verifying : docker-compose-plugin-2.39.1-1.el9.x86_64 6/6
Installed products updated.
Installed:
containerd.io-1.7.27-3.1.el9.x86_64 docker-buildx-plugin-0.26.1-1.el9.x86_64 docker-ce-3:28.3.3-1.el9.x86_64 docker-ce-cli-1:28.3.3-1.el9.x86_64
docker-ce-rootless-extras-28.3.3-1.el9.x86_64 docker-compose-plugin-2.39.1-1.el9.x86_64
Complete!
[root@bastion yum.repos.d]# sudo systemctl start docker
[root@bastion yum.repos.d]# systemctl --no-pager status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; preset: disabled)
Active: active (running) since Wed 2025-08-13 11:03:56 CST; 9s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 34362 (dockerd)
Tasks: 10
Memory: 26.7M
CPU: 479ms
CGroup: /system.slice/docker.service
└─34362 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Aug 13 11:03:54 bastion.downloadocp.com dockerd[34362]: time="2025-08-13T11:03:54.189221994+08:00" level=info msg="CDI directory does not exist, skipping: f…var/run/cdi
Aug 13 11:03:54 bastion.downloadocp.com dockerd[34362]: time="2025-08-13T11:03:54.209069359+08:00" level=info msg="Creating a containerd client" address=/ru…imeout=1m0s
Aug 13 11:03:54 bastion.downloadocp.com dockerd[34362]: time="2025-08-13T11:03:54.509959172+08:00" level=info msg="Loading containers: start."
Aug 13 11:03:55 bastion.downloadocp.com dockerd[34362]: time="2025-08-13T11:03:55.541325673+08:00" level=info msg="Loading containers: done."
Aug 13 11:03:55 bastion.downloadocp.com dockerd[34362]: time="2025-08-13T11:03:55.611857336+08:00" level=info msg="Docker daemon" commit=bea959c containerd-…sion=28.3.3
Aug 13 11:03:55 bastion.downloadocp.com dockerd[34362]: time="2025-08-13T11:03:55.612030376+08:00" level=info msg="Initializing buildkit"
Aug 13 11:03:55 bastion.downloadocp.com dockerd[34362]: time="2025-08-13T11:03:55.984691325+08:00" level=info msg="Completed buildkit initialization"
Aug 13 11:03:56 bastion.downloadocp.com dockerd[34362]: time="2025-08-13T11:03:56.000316561+08:00" level=info msg="Daemon has completed initialization"
Aug 13 11:03:56 bastion.downloadocp.com systemd[1]: Started Docker Application Container Engine.
Aug 13 11:03:56 bastion.downloadocp.com dockerd[34362]: time="2025-08-13T11:03:56.001632717+08:00" level=info msg="API listen on /run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
[root@bastion yum.repos.d]# sudo systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[root@bastion yum.repos.d]# docker version
Client: Docker Engine - Community
Version: 28.3.3
API version: 1.51
Go version: go1.24.5
Git commit: 980b856
Built: Fri Jul 25 11:37:02 2025
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 28.3.3
API version: 1.51 (minimum version 1.24)
Go version: go1.24.5
Git commit: bea959c
Built: Fri Jul 25 11:33:59 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[root@bastion yum.repos.d]#