Docker Installation and Mirror Configuration
Switching to Root User
su
Removing Previous Docker Versions
If Docker is already installed on the system, first remove the existing version:
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
Configuring Docker Repository
First, install the yum-utils package:
yum install -y yum-utils
After successful installation, configure Docker's repository:
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Installing Docker
Execute the following command to install Docker:
yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Starting and Verifying Docker
Check Docker version:
docker -v
Enable Docker to start on boot:
systemctl enable docker
Start Docker service:
systemctl start docker
Verify Docker is running correctly:
docker images
Configuring Docker Mirror Accelerator (Free)
First, visit the official cloud service provider website and register an account
Access the console and navigate to the container image service
Follow the provider's documentation to configure the mirror accelerator. Execute the following commands in your Linux terminal:
- Create Docker configuration directory:
mkdir -p /etc/docker
- Note: The mirror address below is an example. Replace with your actual mirror URL.
tee /etc/docker/daemon. <<-'EOF'
{
"registry-mirrors": ["https://your-mirror-url.example.com"]
}
EOF
- Reload systemd configuration:
systemctl daemon-reload
- Restart Docker service:
systemctl restart docker
After configuring the mirror accelerator, Docker application deployment will be significantly faster