Installation of Linux centos7 docker

1.CentOS Docker installation

Docker supports the following CentOS versions:

  • CentOS 7 (64-bit)
  • CentOS 6.5 (64 bit) or later

2. Preconditions

Currently, only the kernel in the release version of CentOS supports Docker.
Docker runs on CentOS 7. The system is required to be 64 bit and the system kernel version is more than 3.10.
Docker runs on CentOS of CentOS-6.5 or higher. The system is required to be 64 bit and the system kernel version is 2.6.32-431 or higher

3. Method 1: install Docker using yum (under CentOS 7)

Docker requires the kernel version of CentOS system to be higher than 3.10. Check the prerequisites on this page to verify whether your CentOS version supports docker.

uname -r 

Command to view your current kernel version

[root@runoob ~]# uname -r 

Install Docker

Since March 2017, docker has been divided into two branch versions: Docker CE and Docker EE.
Docker CE is the community free version and Docker EE is the enterprise version. It emphasizes security, but it needs to be paid for use.
This article introduces the installation and use of Docker CE.
Remove old version:

$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \

Install some necessary system tools:

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

Add software source information:

sudo yum-config-manager --add-repo

Update yum cache:

sudo yum makecache fast

Install docker Ce:

sudo yum -y install docker-ce

Start Docker background service

sudo systemctl start docker

Test run Hello World

[root@runoob ~] docker run hello-world

Since there is no Hello world image locally, a hello world image will be downloaded and run in the container.

4. Method 2: install Docker using script

(1) Log in to Centos with sudo or root privileges.

(2) Ensure that the yum package is up to date.

$ sudo yum update

(3) Execute the Docker installation script.

$ curl -fsSL -o
$ sudo sh

Executing this script will add Docker Repo source and install Docker.

(4) Start the Docker process.

sudo systemctl start docker

(5) Verify that docker is installed successfully and execute a test image in the container.

$ sudo docker run hello-world
docker ps

Now, the installation of Docker in CentOS system is completed.

5. Image acceleration

In view of the domestic network problems, it is very slow to pull the Docker image later. We need to configure an accelerator to solve it. I use the image address of Netease: .

(1) Aliyun container image acceleration

Install / upgrade Docker client

It is recommended to install Docker client above version 1.10.0. Refer to the documentation docker-ce

Configure image accelerator

For users with Docker client version greater than 1.10.0
You can modify the daemon configuration file / etc / docker / daemon JSON to use the accelerator

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
  "registry-mirrors": [""]
sudo systemctl daemon-reload
sudo systemctl restart docker

(2) Please add in the configuration file (if there is no such file, please create one first):

The new version of Docker uses / etc / Docker / Daemon JSON (Linux) or% programdata% \ Docker \ config \ Daemon JSON (Windows) to configure Daemon.

  "registry-mirrors": [""]

6. Delete Docker CE command

Execute the following command to delete Docker CE:

$ sudo yum remove docker-ce
$ sudo rm -rf /var/lib/docker

It is recommended that Docker install common software:
These include: redis, mongodb, mysql, free oracle, zk, gitlab, tomcat, nginx and other common software installed in Docker
Due to the large number of software installed in the test, it is divided into two pages:
Address 1:
Address 2:

************************End of reading this article************************

Author: the little god of the universe is very cute
 Personal blog:
Gitee Warehouse:
Github Warehouse:
 Description: collect the likes of articles, pay attention not to get lost, so as to avoid not finding them in the future. If you encounter problems, you can comment below

************************End of reading this article************************

Tags: Linux CentOS Docker

Posted by timtom3 on Mon, 09 May 2022 02:34:11 +0300