CentOS operating system installation Docker overview summary

Install Docker

The system requires
Docker to support CentOS 7 at least.
Docker needs to be installed on a 64-bit platform, and the kernel version is not lower than 3.10. CentOS 7 meets the minimum kernel requirements, but due to the low kernel version, some functions (such as overlay2 storage layer driver) cannot be used, and some functions may not be stable.

Use scripts to automatically install
Docker. In order to simplify the installation process, the official provides a set of installation scripts, which can be installed on CentOS systems.

curl -sSL https://get.docker.com/ | sh

After executing this command, the script will automatically complete all preparations and install Docker in the system.
However, due to the great wall, using this script in China may cause some download errors. Some domestic cloud service providers provide a modified version of this script to use the domestic Docker software source image to install, thus avoiding wall interference.

The installation script of
Alibaba Cloud curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/ docker-engine/internet | sh-

Add yum source
Although there is Docker in the CentOS software source Extras, named docker, it is not recommended to use this version in the system source. Its version is relatively old and is not officially maintained by Docker. Therefore, we need to use the CentOS software source officially provided by Docker and
execute the following command to add the yum software source

$ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' 
[dockerrepo] 
name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ 
enabled=1 
gpgcheck=1 
gpgkey=https://yum.dockerproject.org/gpg EOF

**Install Docker **
Update yum software source cache, and install docker-engine.

$ sudo yum update 
$ sudo yum install docker-engine

Start the Docker engine

$ sudo systemctl enable docker 
$ sudo systemctl start docker

Establish docker user group
By default, the docker command will use Unix socket to communicate with the Docker engine. Only the root user and users in the docker group can access the Unix socket of the Docker engine. For security reasons, root users are not directly used on Linux systems. Therefore, it is better to add users who need to use docker to the docker user group.

Create a docker group:

$ sudo groupadd docker 

Add the current user to the docker group:

$ sudo usermod -aG docker $USER

Guess you like

Origin blog.csdn.net/qq_46914021/article/details/109220529