You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker安装指定版本:如何获取版本字符串及构造规则?

How to Find and Install a Specific Docker CE Version

Hey there! I’ve been in your exact situation before—needing to roll back Docker to avoid a buggy latest release, but struggling to track down the exact version string to use. Let’s break this down step by step, no external docs required.

First: List All Available Docker CE Versions

The easiest way to get a full list of installable versions for your system is using your package manager directly. It’ll show you the exact version strings you need to specify:

For Debian/Ubuntu-based systems

Run this command to pull up all available Docker CE versions:

apt-cache madison docker-ce

You’ll see output like this (truncated example):

docker-ce | 5:24.0.6-1ubuntu.22.04jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
docker-ce | 17.12.1ce-0ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages

For RHEL/CentOS/Fedora-based systems

Use this command to list and sort available versions in reverse order:

yum list docker-ce --showduplicates | sort -r

Sample output:

docker-ce.x86_64 3:24.0.6-1.el8 docker-ce-stable
docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable

Second: Install the Exact Version You Need

Once you’ve copied the full version string from the list above, use it to install that specific release:

Debian/Ubuntu

sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

Example for 17.12.1 on Ubuntu Xenial:

sudo apt-get install docker-ce=17.12.1~ce-0~ubuntu-xenial docker-ce-cli=17.12.1~ce-0~ubuntu-xenial containerd.io

RHEL/CentOS

sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

Example for 17.12.1 on CentOS 7:

sudo yum install docker-ce-17.12.1.ce-1.el7.centos docker-ce-cli-17.12.1.ce-1.el7.centos containerd.io

Bonus: Understand the Version String Pattern

Docker CE version strings follow a consistent, distro-specific pattern:

  • For Debian/Ubuntu: <major>.<minor>.<patch>~ce-0~<distro>-<codename> (e.g., 17.12.1~ce-0~ubuntu-xenial)
  • For RHEL/CentOS: <major>.<minor>.<patch>.ce-<release>.<distro codename> (e.g., 17.12.1.ce-1.el7.centos)

This ensures the package manager installs the correct build for your operating system.

Prevent Accidental Updates

After installing your desired version, lock it to avoid automatic updates to a newer (potentially problematic) release:

  • Debian/Ubuntu:
    sudo apt-mark hold docker-ce docker-ce-cli
    
  • RHEL/CentOS:
    sudo yum versionlock docker-ce docker-ce-cli
    

You can verify the installed version anytime with:

docker --version

内容的提问来源于stack exchange,提问作者cool

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:43:18