“This is the third day of my participation in the August More Text Challenge.

Yeasy.gitbooks. IO /docker_prac…

1. The docker installation

Docker installation is simple, execute the following command:

yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y containerd.io docker-ce docker-ce-cli 
Copy the code

Install a specific version:

# list available versions
yum list docker-ce --showduplicates | sort -r
Install a specific version
yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
Copy the code

/var/lib/docker/ contains images, containers, storage, networks, etc. Docker Engine package is docker-CE

Docker engine or Docker engine

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

CentOS 8 uses podman instead of docker by default, so it may report the following error:

Problem with installed package Podman-1.6.4-4.module_EL8.1.0 +298+ 41f9343a.x86_64-package Podman-1.6.4-4.module_el8.1.0 +298+41f9343a.x86_64 requires runc >= 1.0.0-57, but none of the providers can be installedCopy the code

Solutions:

Solution # 1
yum erase podman buildah

# 2
#https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/edge/Packages/
yum install -y https://mirrors.aliyun.com/docker-ce/linux/centos/8/x86_64/edge/Packages/containerd.io-1.3.7-3.1.el8.x86_64.rpm
Copy the code

2. Perform offline installation

How to install Docker offline when the host cannot access the Internet (marked as CentosB) due to confidentiality issues?

The solution is simple:

  • Install a centos system of the same version and environment (minimum installation is recommended and marked as CentosA)
  • Based on CentosA, download the dependency packages that Docker needs to install offline
  • Copy the installation package to CentosB and perform offline installation

CentosA

Download the basic offline package to the /home/rpm/base directory

yum install --downloadonly --downloaddir=/home/rpm/base yum-utils
Copy the code

Install base dependency packages

cd /home/rpm/base
rpm -Uvh *.rpm
Copy the code

Download the docker offline package to the /home/rpm/docker directory

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install --downloadonly --downloaddir=/home/rpm/docker docker-ce docker-ce-cli containerd.io
Copy the code

CentosB

In this case, copy the offline dependency packages in the /home/rpm/base and /home/rpm/docker directories to CentosB, the host that cannot access the Internet, and run the RPM -uvh *. RPM command to complete the docker offline installation

cd /home/rpm/base 
rpm -Uvh *.rpm
cd /home/rpm/docker
rpm -Uvh *.rpm
Copy the code

Simply downloading the RPM of Docker to the target machine for installation often ends in failure because of the dependency on packages.

3. Start the system

systemctl start docker
systemctl enable docker
Copy the code

4. The docker unloading

  1. Uninstall the Docker Engine, CLI, and Containerd packages:

    $ sudo yum remove docker-ce docker-ce-cli containerd.io
    Copy the code
  2. Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:

    $ sudo rm -rf /var/lib/docker
    Copy the code

You must delete any edited configuration files manually.