@@ -138,16 +138,9 @@ install_docker_rhel() {
138138
139139 say " 🐳 Installing Docker with $PM ..."
140140
141- # First try packages commonly available in distribution repositories.
142- if run_as_root " $PM " install -y docker docker-compose-plugin; then
143- return 0
144- fi
145-
146- if run_as_root " $PM " install -y moby-engine docker-compose-plugin; then
147- return 0
148- fi
149-
150- # Then try the official Docker repository through the native package manager.
141+ # Docker CE is the most reliable path for RHEL-compatible distributions,
142+ # including AlmaLinux and Rocky Linux. The CentOS repository is compatible
143+ # with these clones and is the documented upstream repo layout Docker uses.
151144 if [ " $PM " = " dnf" ]; then
152145 run_as_root dnf install -y dnf-plugins-core || true
153146 if command_exists dnf-3; then
@@ -160,7 +153,29 @@ install_docker_rhel() {
160153 run_as_root yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo || true
161154 fi
162155
163- run_as_root " $PM " install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
156+ if [ " $PM " = " dnf" ]; then
157+ if run_as_root dnf install -y --allowerasing docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin; then
158+ return 0
159+ fi
160+
161+ # Older EL 9 point releases can fail best-candidate resolution for Docker's
162+ # repo packages. Retrying with --nobest keeps the install native while still
163+ # letting DNF pick a compatible package set.
164+ if run_as_root dnf install -y --allowerasing --nobest docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin; then
165+ return 0
166+ fi
167+ else
168+ if run_as_root yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin; then
169+ return 0
170+ fi
171+ fi
172+
173+ # Fall back to distribution packages only after Docker CE has failed.
174+ if run_as_root " $PM " install -y docker docker-compose-plugin; then
175+ return 0
176+ fi
177+
178+ run_as_root " $PM " install -y moby-engine docker-compose-plugin
164179}
165180
166181install_docker_arch () {
0 commit comments