Installation of Docker in Centos8 of container technology
1, Docker introduction
Docker Manual: https://docs.docker.com/install/linux/docker-ce/centos/
Docker is an open source / 246339) application container engine, which allows developers to package their applications and dependency packages into a portable image, and then publish them to any popular Linux or Windows machine, or realize virtualization. Containers are completely sandboxed and have no interface with each other.
2, Docker installation
2.1. Delete the old Docker
[root@localhost ~]# yum remove docker docker-common docker-selinux docker-engine Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository PowerTools is listed more than once in the configuration Repository AppStream is listed more than once in the configuration No matching parameters found: docker No matching parameters found: docker common No matching parameters found: docker SELinux No matching parameters found: docker engine No packages need to be removed. Dependency resolution. No processing is required. Complete!
2.2. Installation dependency
[root@localhost ~]# yum install -y yum-utils \ > device-mapper-persistent-data \ > lvm2 Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository PowerTools is listed more than once in the configuration Repository AppStream is listed more than once in the configuration CentOS-8 - Base 3.3 MB/s | 4.0 MB 00:01 Extra Packages for Enterprise Linux Modular 8 - x86_64 7.9 kB/s | 13 kB 00:01 The package device-mapper-persistent-data-0.8.5-2.el8.x86_isinstalled. Package lvm2-8: 2.03.05-5.el8.0.1.x86_isinstalled. Dependency resolution. ============================================================================================================================================== Package architecture version warehouse size ============================================================================================================================================== Installation: yum-utils noarch 4.0.8-3.el8 BaseOS 64 k Transaction summary ============================================================================================================================================== Install 1 package Total downloads: 64 k Installation size: 19 k Download package: yum-utils-4.0.8-3.el8.noarch.rpm 295 kB/s | 64 kB 00:00 ---------------------------------------------------------------------------------------------------------------------------------------------- Total 87 KB / s | 64 kb 00:00 Run transaction check Transaction check succeeded. Run transaction test Transaction test succeeded. Operational transaction In preparation: 1 / 1 Installation: yum-utils-4.0.8-3.el8.noarch 1 / 1 Running script: yum-utils-4.0.8-3.el8.noarch 1 / 1 Validation: yum-utils-4.0.8-3.el8.noarch 1 / 1 Installed: yum-utils-4.0.8-3.el8.noarch Complete!
2.3. View Docker version
[root@localhost ~]# yum list docker-ce --showduplicates | sort -r Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository PowerTools is listed more than once in the configuration Repository AppStream is listed more than once in the configuration Extra Packages for Enterprise Linux Modular 8 - 6.1 kB/s | 9.4 kB 00:01 Extra Packages for Enterprise Linux 8 - x86_64 6.5 kB/s | 10 kB 00:01 docker-ce.x86_64 3:19.03.5-3.el7 docker-ce-stable docker-ce.x86_64 3:19.03.4-3.el7 docker-ce-stable docker-ce.x86_64 3:19.03.3-3.el7 docker-ce-stable docker-ce.x86_64 3:19.03.2-3.el7 docker-ce-stable docker-ce.x86_64 3:19.03.1-3.el7 docker-ce-stable docker-ce.x86_64 3:19.03.0-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.9-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.8-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.7-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.6-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.5-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.4-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.3-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.2-3.el7 docker-ce-stable 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.3.ce-3.el7 docker-ce-stable docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
2.4. Installing Docker
This is an installation error
[root@localhost ~]# yum install docker-ce Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository PowerTools is listed more than once in the configuration Repository AppStream is listed more than once in the configuration //Last metadata expiration check: before 0:00:38, it will be executed at 17:02:33 on Tuesday, January 28, 2020. //Error: //Question: package docker-ce-3: 19.03.5-3.el7.x86_requirementscontained.io >= 1.2.2-3, but none of the providers can be installed - cannot install the best candidate for the job - package containerd.io-1.2.10-3.2.el7.x86_64 is excluded - package containerd.io-1.2.2-3.3.el7.x86_64 is excluded - package containerd.io-1.2.2-3.el7.x86_64 is excluded - package containerd.io-1.2.4-3.1.el7.x86_64 is excluded - package containerd.io-1.2.5-3.1.el7.x86_64 is excluded - package containerd.io-1.2.6-3.3.el7.x86_64 is excluded (Try adding '--skip-broken' To skip packages that cannot be installed or '--nobest' To use more than the best choice of packages)
At this time, containerd.io needs to be installed. We can go to the website https://download.docker.com/linux/centos/7/x86_/stable/packages/ to find the latest one to install
[root@localhost ~]# dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
Continue with installation
[root@localhost ~]# yum install docker-ce docker-ce-cli
2.5. Start Docker and set it to start automatically
[root@localhost ~]# systemctl start docker [root@localhost ~]# systemctl enable docker Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
3, Docker compose installation
Because CentOS 8 has Python 3 and pip3 installed, you can install them directly. I can 't install docker-compose in Centos7 with pip2. I really feel deeply rooted!
[root@localhost ~]# pip3 -V pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6) [root@localhost ~]# pip3 install docker-compose [root@localhost ~]# docker-compose version docker-compose version 1.25.3, build unknown docker-py version: 4.1.0 CPython version: 3.6.8 OpenSSL version: OpenSSL 1.1.1c FIPS 28 May 2019 [root@localhost ~]#
4, Modify Docker download source
Log in to alicloud: https://cr.console.aliyun.com/cn-hangzhou/mirrors. The last column is image accelerator. It will have its own image accelerator address.
Select Centos to execute:
sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://xxxxx.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker