English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CentOS Docker-Installation

Docker supports the following 64 Version of CentOS:

  • CentOS 7

  • CentOS 8

  • Higher version...

Install automatically using the official installation script

The installation command is as follows:

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

You can also use the one-click installation command of daocloud in China:

curl -sSL https://get.daocloud.io/docker | sh

Manual Installation

Uninstall the old version

Older Docker versions are called docker or docker-engine. If these programs are already installed, please uninstall them and their related dependencies.

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

Install Docker Engine-Community

Install using Docker repositories

First install Docker Engine on a new host-Before Community, you need to set up the Docker repository. After that, you can install and update Docker from the repository.

Set repository

Install the required software packages. yum-utils provides yum-config-manager , and the device mapper storage driver requires device-mapper-persistent-data and lvm2.

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

Use the following command to set up a stable repository.

Use the official source address (slower)

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

You can choose some domestic source addresses:

Aliyun

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

Tsinghua University Source

$ sudo yum-config-manager \\
    --add-repo \\
    https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo

Install Docker Engine-Community

Install the latest version of Docker Engine-Community and containerd, or proceed to the next step to install a specific version:

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

If prompted to accept the GPG key, please select Yes.

Do you have multiple Docker repositories?

If multiple Docker repositories are enabled, installations or updates without specifying a version in the yum install or yum update command will always install the highest version, which may not be suitable for your stability requirements.

Docker is not started by default after installation, and the docker user group has been created, but there are no users under this group.

To install a specific version of Docker Engine-Community, please list the available versions in the repository and then select and install:

1、Liste und sortiere die verfügbaren Versionen in Ihrem Repository. Dieser Beispiel sortiert die Ergebnisse nach Versionsnummer (von hoch nach niedrig).

$ yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64  3:18.09.1-3.el7                     docker-ce-stable
docker-ce.x86_64  3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64  18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64  18.06.0.ce-3.el7                    docker-ce-stable

2、Installieren Sie eine bestimmte Version über deren vollständigen Paketnamen, der als Paketname (docker-ce) mit der Versionszeichenfolge (zweite Spalte), von der ersten Doppelpunkt (:) bis zur ersten Bindestrich(-), und mit einem Bindestrich(-) getrennt. Zum Beispiel: docker-ce-18.09.1.

$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

Docker starten.

$ sudo systemctl start docker

Durch Ausführen von hello-welt-Image, um zu überprüfen, ob Docker Engine korrekt installiert ist-Community .

$ sudo docker run hello-welt