1. Uninstall the old version

Older versions of Docker are called Docker or Docker-Engine. If these programs are installed, uninstall them and their associated dependencies.


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

Copy the code

2. Install plug-ins required by Docker

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

Copy the code

3. Set up stable repositories

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

Copy the code

4. (Optional) Enable repository

sudo yum-config-manager--enable docker-ce-nightly

Copy the code

Install the latest Docker Engine-Community and containerd versions

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

Copy the code

Or select the repository to use other versions

1. Query the available version:
yum list docker-ce--show duplicates| sort-r

Copy the code
2. Install the specified version
Sudo yum install docker-ce-[错 误 错 误] docker-ce-cli-[错 误 错 误 错 误] containerd. IOCopy the code

6. The installation is complete and starts

sudo systemctl start docker

Copy the code

7. Verify installation

sudo docker run hello-world

Copy the code
  • For details, see the documentation