Installing docker in CentOS

Time:2021-1-13

1. Check whether docker has been installed before, and then uninstall it

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

2. Installation environment dependence

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

sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

Install docker

$ sudo yum install docker-ce docker-ce-cli containerd.io

Start docker service

sudo systemctl start docker 

Test whether docker is installed successfully

Sudo docker run Hello World: Hello from docker indicates successful installation

Official installation tutorial address:docs.docker.com/install/linux/dock…

This work adoptsCC agreementReprint must indicate the author and the link of this article