CentOS 7 configuring docker and setting and configuring image acceleration

1. Version Description

Docker supports the following 64 bit CentOS versions:

  • CentOS 7
  • CentOS 8
  • Later version

2. Use the official installation script to install automatically

Note that it is best to enter the administrator mode in advance when executing the following commands

The installation commands are as follows:

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

You can also use the domestic daocloud one click installation command:

curl -sSL https://get.daocloud.io/docker | sh

3. Install Docker engine community and use Docker warehouse for installation

Before installing Docker engine community on the new host for the first time, the Docker warehouse needs to be set. After that, you can install and update Docker from the warehouse. Insert the code slice here

Set up warehouse

Install the required packages. Yum utils provides Yum config manager, and the device mapper storage driver requires device mapper persistent data and lvm2.

sudo yum install -y yum-utils \
  device-mapper-persistent-data \

Use the following command to set up a stable warehouse

Use the official source address (relatively slow)

sudo yum-config-manager \
    --add-repo \

You can select some domestic source addresses:

Alibaba cloud

 sudo yum-config-manager \
    --add-repo \

Tsinghua University source

 sudo yum-config-manager \
    --add-repo \

Install docker engine community

Install the latest version of docker engine community and containerd, or go to the next step to install a specific version:

sudo yum install docker-ce docker-ce-cli containerd.io

If you are prompted to accept the GPG key, select Yes.

Docker is not started by default after installation. The docker user group has been created, but there are no users under this user group.

To install a specific version of docker engine community, list the available versions in the repository, and then select and install:

1. Lists and sorts the versions available in your repository. This example sorts the results by version number (from high to low)

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

docker-ce.x86_64  3:18.09.1-3.el7                     docker-ce-stable
docker-ce.x86_64  3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64  18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64  18.06.0.ce-3.el7                    docker-ce-stable

2. Install a specific version through its complete package name, which is the package name (docker CE) plus the version string (second column), from the first colon (:) to the first hyphen, separated by a hyphen (-). For example: docker-ce-18.09.1.

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

Start Docker.

sudo systemctl start docker

Verify that docker engine community is installed correctly by running the Hello world image.

sudo docker run hello-world

Uninstall docker

To delete an installation package:

yum remove docker-ce

Delete images, containers, configuration files, etc.:

rm -rf /var/lib/docker

Configure mirror acceleration

1. First open the daemon.json file with the following command (if not, create it)

vim /etc/docker/daemon.json

2. Add the following to it

        "registry-mirrors": ["http://hub-mirror.c.163.com", "https://docker.mirrors.ustc.edu.cn"]

3. when the configuration is completed, call the following command to reload the configuration.

sudo systemctl daemo-reload

Or restart docker

sudo systemctl restart docker

Tags: Linux CentOS Docker

Posted on Mon, 18 Oct 2021 02:37:46 -0400 by qadeer_ahmad