Skip to content

Docker Binary Installation Guide in the Context of CentOS 7 EOL ​

vCenter Server 8.0 installation and deployment diagram

Background Information ​

CentOS 7 has already been June 30, 2024 Officially discontinued maintenance (End of Life, EOL). This means:

  • Official yum repository (mirror.centos.org)is no longer available

  • Third-party repositories such as EPEL are successively ending support for CentOS 7.

  • through yum Installing Docker will face the issue of being unable to download dependency packages.

In this context,Binary deployment Become the most reliable and direct way to install Docker on CentOS 7.

Solution Advantages ​

Comparison itemyum installBinary installation
Dependency handlingNeed to resolve dependencies such as container-selinux.Completely dependency-free, runs directly.
Source availabilityCentOS 7 repositories become invalid after EOLNo impact, just download the tar package directly.
Installation speedDepends on network and source speed.Quickly, complete it within 5 minutes.
Applicable scenariosAn environment with a stable sourceLegacy systems, offline environments, EOL systems
Upgrade methodyum update Automatic upgradeManually download the new version and replace it.

Precondition ​

  • Operating system: CentOS 7 (kernel version ≥ 3.10)

  • Network environment: able to access the official Docker download site or Alibaba Cloud mirror site

  • User permissions: root or with sudo privileges

Check kernel version:

bash
uname -r
# Example output: 5.14.21-20230616.el7.x86_64

Installation Steps ​

Step 1: Download the Docker binary package ​

bash
# Enter the temporary directory
cd /tmp

# Install wget (skip if already installed)
sudo yum install -y wget

# Download from the official source (recommended)
sudo wget https://download.docker.com/linux/static/stable/x86_64/docker-26.1.4.tgz

# Or download from the Alibaba Cloud mirror (recommended for users in China)
# sudo wget https://mirrors.aliyun.com/docker-ce/linux/static/stable/x86_64/docker-26.1.4.tgz

Version Notes:26.1.4 is a verified stable version. To access other versions, please visit:

Step 2: Extract and install the binary files ​

bash
# Extract the archive
sudo tar -xzvf docker-26.1.4.tgz

# Copy the binary file to the system PATH
sudo cp docker/* /usr/bin/

At this point, the Docker core commands (docker,dockerd etc.) are already available, but still need to be configured as system services to start automatically on boot.

Step 3: Create the Docker user group (optional) ​

bash
# Create docker user group
sudo groupadd docker

# Add the current user to the docker group (to avoid using sudo every time)
sudo usermod -aG docker $USER

Step 4: Configure the systemd service ​

Create a systemd service file for Docker so that it can be systemctl Management:

bash
sudo cat > /etc/systemd/system/docker.service << 'EOF'
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target
EOF

Step 5: Start the Docker service ​

bash
# Reload systemd configuration
sudo systemctl daemon-reload

# Start Docker
sudo systemctl start docker

# Set to start on boot
sudo systemctl enable docker

# Check service status
sudo systemctl status docker

Step 6: Verify the installation ​

bash
# View Docker version information
sudo docker version

# Run the hello-world container to verify
sudo docker run hello-world

If you see the following output, the installation was successful:

Hello from Docker!
This message shows that your installation appears to be working correctly.
...

Common troubleshooting ​

1. Non-root users cannot run Docker commands ​

bash
# Log in again or execute the following command
newgrp docker

CentOS 7 kernel supports by default overlay2 Storage driver, no additional configuration required. Check the storage driver:

bash
sudo docker info | grep "Storage Driver"
# Should output: Storage Driver: overlay2

3. Firewall prevents containers from accessing the network ​

bash
# Temporarily disable the firewall (for testing)
sudo systemctl stop firewalld

# Or open the ports required by Docker
sudo firewall-cmd --permanent --add-port=2375/tcp
sudo firewall-cmd --reload

If a version update causes the link to return 404, you can visit the download directory to get the latest version number:

bash
# Official download directory
curl -s https://download.docker.com/linux/static/stable/x86_64/ | grep -o 'docker-[0-9.]*\.tgz' | sort -V | tail -1

# Alibaba Cloud mirror directory
curl -s https://mirrors.aliyun.com/docker-ce/linux/static/stable/x86_64/ | grep -o 'docker-[0-9.]*\.tgz' | sort -V | tail -1

Configure Docker daemon proxy ​

Important: The Docker daemon (dockerd) does not read shell environment variables and must be configured separately.

bash
# 1. Create Docker service configuration directory
sudo mkdir -p /etc/systemd/system/docker.service.d

# 2. Write proxy configuration
sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf <<'EOF'
[Service]
Environment="HTTP_PROXY=http://192.168.0.237:7890"
Environment="HTTPS_PROXY=http://192.168.0.237:7890"
Environment="NO_PROXY=localhost,127.0.0.1,.local,.aliyuncs.com"
EOF

# 3. Reload and restart Docker (must be executed after subsequent installation)
# sudo systemctl daemon-reload
# sudo systemctl restart docker

⚠️ Pitfall reminder: Do not include .docker.io in NO_PROXY, otherwise Docker Hub traffic will not go through the proxy.

Configure Docker image accelerator ​

Create or modify /etc/docker/daemon.json:

bash
sudo mkdir -p /etc/docker
sudo cat > /etc/docker/daemon.json << 'EOF'
{
  "registry-mirrors": [
    "https://docker.m.daocloud.io",
    "https://free.hubfast.cn"
  ],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m",
    "max-file": "3"
  }
}
EOF

# Restart Docker to apply the configuration.
sudo systemctl restart docker

⚠️ Docker 镜像加速器参考

Upgrade Docker version ​

When an upgrade is required, download the new version package and overwrite it./usr/bin/ the binary file under [the directory], then restart the service:

bash
# Download new version
wget https://download.docker.com/linux/static/stable/x86_64/docker-new version number.tgz
tar -xzvf docker-new-version-number.tgz
sudo cp docker/* /usr/bin/

# Restart service
sudo systemctl restart docker

Summary ​

Against the backdrop of CentOS 7 EOL, installing Docker from binaries offers the following significant advantages:

  • Bypass invalid sources Without relying on any yum repository, directly download the official precompiled package.

  • No dependency conflicts: No processing required container-selinux,slirp4netns and other dependency packages

  • Rapid deployment: Complete the entire process from download to verification within 5 minutes

  • Strong controllability: Can precisely specify versions, facilitating offline deployment and version management

Although CentOS 7 has reached end of life, Docker can still run stably on it through binary installation, providing a feasible path for containerizing legacy systems.

Reference materials ​

Suggestion: For production environments, please plan to migrate to actively maintained distributions such as Rocky Linux / AlmaLinux as soon as possible.

Last updated on11/07/2026, 02:16 PM
@fishfinal | @fishfinals | [email protected]