Centos7 install docker container detailed steps

centos7 installation docker detailed steps
environment requirements: centos7.0 or above (docker supports the minimum version)
steps are as follows:

1. Delete the previously installed docker (if it has not been installed before, this step is omitted...)

Enter the root directory of centos and execute the following command (\ is a command line break in the Linux system, if the command is too long, you can use \ to break the line)

yum remove docker \
docker-client \
docker-client-latest \
docker- common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-sqlinux \
docker-engine-selinux \
docker-engine \
docker-ce

Two, virtual machine networking, install yum tool

Execute the following command

yum install -y yum-utils \
devi ce-mapper-pers istent-data \
1vm2 --ski p- broken

3. Set the docker image source

Execute the following command

yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/1inux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g'
/etc/yum.repos.d/docker-ce.repo
yum makecache fast

4. Install docker (if the network speed is slow, you need to wait)

yum install -y docker-ce

**insert image description here
**

5. Preparation before starting docker**

(The docker application needs to use various ports, and it is troublesome to set them one by one. It is recommended to close the firewall directly) Please say the important thing three times: before starting docker, you must close the firewall, before starting docker, you must close the firewall, before starting docker, Be sure to close the firewall (you can check whether it is closed by checking the status of the firewall before closing)

#关闭
systemctl stop firewalld
#禁止开机启动防火墙
systemctl disable firewalld

insert image description here

6. Start docker

systemctl start docker

insert image description here

There are many ways to check whether the startup is successful

(1)查看状态:systemctl status docker

insert image description here

(2)查看docker 版本

insert image description here

* 7. Don’t be in a hurry to use docker after moving. First, you should perform docker image acceleration. The network speed of docker’s official image warehouse is poor. If you set up a domestic image, Alibaba Cloud is the first choice. Refer to Alibaba Cloud’s image acceleration document: https://cr.console .aliyun.com/cn-hangzhou/instances/mirrors We choose centOS here (as shown in the picture below, just execute the command in the picture)

  • insert image description here

Guess you like

Origin blog.csdn.net/qiaojunt/article/details/125051407
Recommended