CentOS7 docker installation

I. Overview

Note: Make sure your Linux system kernel version is higher than 3.10, and the system is 64-bit, in order to experience Docker.

Docker supports the following 64-bit CentOS versions:

The centos-extras library must be enabled. By default, this repository is enabled, but if it has been disabled, you need to re-enable it.

It is recommended to use overlay2 storage driver.

Uninstall the old version

The older version of Docker is called docker or docker-engine. If these programs are already installed, please uninstall them and related dependencies.

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

Two, install Docker

This article uses centos 7.4

Install epel update source

yum install -y vim wget epel-release

Install using Docker repository

Before installing Docker Engine-Community on the new host for the first time, you need to set up the Docker repository. After that, you can install and update Docker from the repository.

Set up warehouse

Install the required software 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 \
 lvm2

Use the following command to set up a stable warehouse.

sudo yum-config-manager \    
 - - add-repo \
 https://download.docker.com/linux/centos/docker-ce.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 -y docker-ce docker-ce-cli containerd.io

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

Are there multiple Docker repositories?

If multiple Docker repositories are enabled, if the version is not specified in the yum install or yum update command, the installation or update will always install the highest version, which may not suit your stability requirements.

Docker is not started by default after installation. And 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, please list the available versions in the repository, then select and install:

1、 List and sort 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:19.03.4-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.4-3.el7                    @docker-ce-stable
docker-ce.x86_64            3:19.03.3-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.2-3.el7                    docker-ce-stable 
...

2、 Install a specific version by its full package name, which is the package name (docker-ce) plus the version string (second column), from the first colon (:) all the way to the first hyphen , And separated by a hyphen (-). For example: docker-ce-19.03.4.

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

E.g:

yum install -y docker-ce-19.03.5-3.el7 docker-ce-cli-19.03.5-3.el7 containerd.io

Start Docker.

sudo systemctl start docker

Run the hello-world image to verify that Docker Engine-Community is installed correctly.

sudo docker run hello-world

Three, configure 163 mirror acceleration

Increase configuration

sudo tee /etc/docker/daemon.json <<-'EOF'{"registry-mirrors":["http://hub-mirror.c.163.com"]}
EOF

Restart docker

sudo systemctl restart docker

Install docker command completion tool

yum install -y bash-completion

Note: After the installation is complete, you must log out of the user, log in again, and that's it

Set docker to start automatically

systemctl enable docker

Reference link for this article:

https://www.runoob.com/docker/centos-docker-install.html

Recommended Posts

Docker installation (CentOS7 installation)
CentOS7 docker installation
Docker CentOS installation method
Centos7 docker installation details
2019-07-09 CentOS7 installation
centos7_1708 installation
CentOS environment installation of Docker
Docker EE installation on centos7
Python - centos6 installation
Centos7 install Docker
Centos7 install docker18
centos7 install docker
CentOS 6 install Docker
Centos8 install Docker
CentOS container installation in Docker uses MySQL
CentOS online installation RabbitMQ3.7
Zabbix 2.2.20 installation details (Centos6.9)
Centos source installation Python3
lamp (centos7) installation lamp environment
Centos7 mqtt cluster installation
CentOS 8.0 installs docker error
Graphical installation of CentOS8
Linux notes (1): CentOS-7 installation
CentOS 8-dnf install docker
Redis3 installation under Centos7
install Docker on centos6.5
CentOS online installation RabbitMQ3.7
Linux CentOS 7 installation tutorial
CentOS 7 install Docker CE
Discourse CentOS 8 new installation manual
Build docker environment under Centos6.5
Centos 7 mini installation process record
Centos mysql installation and configuration
CentOS 8 (2)
Glusterfs cluster installation on Centos7
Redis cluster installation under CentOS
Centos7 installation and configuration prometheus
CentOS 7 Galera Cluster installation guide
CentOS 6.x installation mysql5.7 record
Install docker transfer on Centos7
CentOS installation and configuration cmake
Graphical centos installation detailed process
Redis cluster installation under CentOS
Hyper-V + CentOS7 installation video tutorial
centos7 kvm installation and use
Install docker on Centos system
Centos7 silent installation of Oracle11g
CentOS 6.8 virtual machine installation details
CentOS 8 (1)
CentOS7 postgresql installation and use
Centos7 installation tomcat process introduction
Centos7.4 environment installation lamp-php7.0 tutorial
Discourse CentOS 8 new installation manual
CentOS8 Linux 8.0.1905 installation process (illustration)
Centos7 elk7.1.1 installation and use
Centos7 installation and configuration of Jenkins
Analysis of Hyper-V installation CentOS 8 problem
Centos iso image file installation tutorial
Centos7 installation is actually very simple
Centos6.5 installation and deployment of KVM
CentOS 8 installation of MariaDB detailed tutorial