Install docker for CentOS

Time:2021-1-20

Environment: Linux centos8 4.18.0-80.el8.x86_ 64、docker-19.03.5

1. Preconditions

Requires OS kernel 3.10+
Uname - R // view the operating system version number

Install docker for CentOS

2. Check if it is installed (uninstalled)

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

You can also uninstall in the following ways:
*Yum list installed | grep docker // find installed dockers
* yum remove docker-ce.x86_ 64 docker-ce-cli.x86_ 64 - Y // uninstall and install
*RM - RF / var / lib / docker // delete directory file

Install docker for CentOS

Install docker for CentOS

3. Set up warehouse

To install the required software package, yum utils provides Yum config manager, and the device mapper storage driver requires device mapper persistent data and lvm2
* yum install -y yum-utils \
        device-mapper-persistent-data
        lvm2

Install docker for CentOS

Set up a stable warehouse
yum-config-manager \
           --add-repo \
           https://download.docker.com/linux/centos/docker-ce.repo

Install docker for CentOS

4. Install docker engine community

yum install docker-ce docker-ce-cli  containerd.io  //The latest version is installed by default

Install docker for CentOS

Installation error, because Yum is installed containerd.io Too low, need to download and install higher version containerd.io >=1.2.2-3
Solution:
dnf install  https://download.docker.com/linux/centos/7/x86_ 64/stable/Packages/ containerd.io -1.2.6-3.3.el7.x86_ 64. RPM // DNF is a better RPM tool

Install docker for CentOS

Then continue to install docker Ce (background service) and docker CE cli (client)
yum install docker-ce docker-ce-cli

Install docker for CentOS

5. Start docker service

* systemctl start docker
* systemctl enable docker
* systemctl status docker

Install docker for CentOS

6. Check whether the installation is successful

docker version

Install docker for CentOS

7. Docker other command test

* docker iamges
* docker ps
*Docker search image

Install docker for CentOS

8. Postscript

You can choose to install different versions of docker CE and docker CE cli
*Yum list docker CE -- showduplicates | sort - R // list of different versions
*Yum list docker CE cli -- showduplicates | sort - R // list of different versions

Install docker for CentOS

Install docker for CentOS

Installation:
yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING>

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

Aduh

Recommended Today

Video compatibility in wechat

1. In line properties of video tag SRC: URL of video Poster: Video cover, no picture displayed when playing Preload: preload Autoplay: autoplay Loop: loop playback Controls: browser’s own control bar Width: video width Height: video height style=”object-fit:fill” /Adding this style will make the Android / Web video full screen in wechat. If it is […]