Install Docker under CentOS 8.3

1. Update the yum source and wait for the update to complete

Excuting an order:

yum -y update

2. Centos8 is modified to Ali's yum source

1. Obtain the Ali yum source configuration file

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

2. Update cache

yum makecache

3. Install docker

1. Install the required software packages, yum-util provides the yum-config-manager function, and the other two are dependent on the devicemapper driver

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

2. Set yum source

//We are going to use domestic

yum-config-manager \
    --add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3. View all docker versions in all warehouses, and select a specific version to install

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

4. We install the first version

sudo yum install docker-ce docker-ce-3:20.10.7-3.el8

Just enter y twice in the process.

5. Start and join the startup

sudo systemctl start docker
sudo systemctl enable docker

6. Verify whether the installation is successful (there are two parts, client and service, indicating that the docker installation and startup are successful)

docker version

4. How to Configure Alibaba Cloud Image Accelerator with Docker

1. Create a folder

sudo mkdir -p /etc/docker

2. Edit the /etc/docker/daemon.json file and enter the domestic mirror source address

Note: Alibaba Cloud and daocloud image acceleration need to register an account, Alibaba Cloud official website: https://www.aliyun.com/ 

After logging in, select the console, find the container mirroring service , mirroring tool, and mirroring accelerator to find the accelerator address.

sudo vi /etc/docker/daemon.json

{

        "registry-mirrors": ["https://yrlbsq5s.mirror.aliyuncs.com"]

}

I enter the editor, paste the esc, and then: wq! quit.

3. After modifying the address, reload the configuration file and restart the docker service

sudo systemctl daemon-reload
sudo systemctl restart docker

4. Verify that mirroring acceleration is configured successfully

sudo docker info

5. Docker's default official mirror warehouse

Docker Hub

Including various mirrors, there is always one that suits you

Guess you like

Origin blog.csdn.net/qq_36539042/article/details/117593054