CentOS Linux release 7.9.2009 (Core)
1,yum工具安装
yum install yum-utils -y
2,配置docker镜像仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3,docker软件安装
缺少container-selinux 依赖软件包。
[root@i-AAB0CE27 yum.repos.d]# yum install docker-ce-18.03.1.ce -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
docker-ce-stable | 3.5 kB 00:00:00
(1/2): docker-ce-stable/7/x86_64/updateinfo | 55 B 00:00:00
(2/2): docker-ce-stable/7/x86_64/primary_db | 70 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:18.03.1.ce-1.el7.centos will be installed
--> Processing Dependency: libseccomp >= 2.3 for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: pigz for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libcgroup for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libltdl.so.7()(64bit) for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libseccomp.so.2()(64bit) for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Running transaction check
---> Package docker-ce.x86_64 0:18.03.1.ce-1.el7.centos will be installed
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: pigz for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
---> Package libseccomp.x86_64 0:2.3.1-4.el7 will be installed
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
--> Finished Dependency Resolution
Error: Package: docker-ce-18.03.1.ce-1.el7.centos.x86_64 (docker-ce-stable)
Requires: pigz
Error: Package: docker-ce-18.03.1.ce-1.el7.centos.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2.9
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
[root@i-AAB0CE27 yum.repos.d]# yum install container-selinux
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
No package container-selinux available.
Error: Nothing to
4,配置依赖仓库
要不然确实container-selinux软件依赖包
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
5,docker软件安装
[root@i-AAB0CE27 yum.repos.d]# yum install docker-ce-18.03.1.ce -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
- base: mirrors.aliyun.com
- extras: mirrors.aliyun.com
- updates: mirrors.aliyun.com
base/7/x86_64/primary_db | 6.1 MB 00:00:05
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:18.03.1.ce-1.el7.centos will be installed
--> Processing Dependency: libseccomp >= 2.3 for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: pigz for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libcgroup for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libltdl.so.7()(64bit) for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libseccomp.so.2()(64bit) for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
--> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
---> Package libseccomp.x86_64 0:2.3.1-4.el7 will be installed
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
---> Package pigz.x86_64 0:2.3.3-1.el7.centos will be installed
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.5-34.el7 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.5-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================================
Package Arch Version Repository Size
Installing:
docker-ce x86_64 18.03.1.ce-1.el7.centos docker-ce-stable 35 M
Installing for dependencies:
audit-libs-python x86_64 2.8.5-4.el7 base 76 k
checkpolicy x86_64 2.5-8.el7 base 295 k
container-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 k
libcgroup x86_64 0.41-21.el7 base 66 k
libseccomp x86_64 2.3.1-4.el7 base 56 k
libsemanage-python x86_64 2.5-14.el7 base 113 k
libtool-ltdl x86_64 2.4.2-22.el7_3 base 49 k
pigz x86_64 2.3.3-1.el7.centos extras 68 k
policycoreutils-python x86_64 2.5-34.el7 base 457 k
python-IPy noarch 0.75-6.el7 base 32 k
setools-libs x86_64 3.3.8-4.el7 base 620 k
Transaction Summary
Install 1 Package (+11 Dependent packages)
Total download size: 36 M
Installed size: 40 M
Downloading packages:
libcgroup-0.41-21.el7.x86_64.r FAILED
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/libcgroup-0.41-21.el7.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
warning: /var/cache/yum/x86_64/7/extras/packages/container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm is not installed
(1/12): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm | 40 kB 00:00:00
Public key for audit-libs-python-2.8.5-4.el7.x86_64.rpm is not installed
(2/12): audit-libs-python-2.8.5-4.el7.x86_64.rpm | 76 kB 00:00:00
(3/12): libseccomp-2.3.1-4.el7.x86_64.rpm | 56 kB 00:00:00
(4/12): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm | 49 kB 00:00:00
(5/12): pigz-2.3.3-1.el7.centos.x86_64.rpm | 68 kB 00:00:00
(6/12): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00:00
(7/12): policycoreutils-python-2.5-34.el7.x86_64.rpm | 457 kB 00:00:00
(8/12): libcgroup-0.41-21.el7.x86_64.rpm | 66 kB 00:00:00
(9/12): setools-libs-3.3.8-4.el7.x86_64.rpm | 620 kB 00:00:00
checkpolicy-2.5-8.el7.x86_64.r FAILED ======================= ] 1.0 MB/s | 30 MB 00:00:05 ETA
http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/libsemanage-python-2.5-14.el7.x86_64.rpm: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/libsemanage-python-2.5-14.el7.x86_64.rpm: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
(10/12): checkpolicy-2.5-8.el7.x86_64.rpm | 295 kB 00:00:00
(11/12): libsemanage-python-2.5-14.el7.x86_64.rpm | 113 kB 00:00:00
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm is not installed
(12/12): docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm | 35 MB 00:00:35
Total 1.0 MB/s | 36 MB 00:00:35
Retrieving key from http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
From : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <docker@docker.com>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libcgroup-0.41-21.el7.x86_64 1/12
Installing : pigz-2.3.3-1.el7.centos.x86_64 2/12
Installing : setools-libs-3.3.8-4.el7.x86_64 3/12
Installing : audit-libs-python-2.8.5-4.el7.x86_64 4/12
Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64 5/12
Installing : python-IPy-0.75-6.el7.noarch 6/12
Installing : libseccomp-2.3.1-4.el7.x86_64 7/12
Installing : libsemanage-python-2.5-14.el7.x86_64 8/12
Installing : checkpolicy-2.5-8.el7.x86_64 9/12
Installing : policycoreutils-python-2.5-34.el7.x86_64 10/12
Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 11/12
Installing : docker-ce-18.03.1.ce-1.el7.centos.x86_64 12/12
Verifying : checkpolicy-2.5-8.el7.x86_64 1/12
Verifying : docker-ce-18.03.1.ce-1.el7.centos.x86_64 2/12
Verifying : libsemanage-python-2.5-14.el7.x86_64 3/12
Verifying : libseccomp-2.3.1-4.el7.x86_64 4/12
Verifying : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 5/12
Verifying : python-IPy-0.75-6.el7.noarch 6/12
Verifying : libtool-ltdl-2.4.2-22.el7_3.x86_64 7/12
Verifying : policycoreutils-python-2.5-34.el7.x86_64 8/12
Verifying : audit-libs-python-2.8.5-4.el7.x86_64 9/12
Verifying : setools-libs-3.3.8-4.el7.x86_64 10/12
Verifying : pigz-2.3.3-1.el7.centos.x86_64 11/12
Verifying : libcgroup-0.41-21.el7.x86_64 12/12
Installed:
docker-ce.x86_64 0:18.03.1.ce-1.el7.centos
Dependency Installed:
audit-libs-python.x86_64 0:2.8.5-4.el7 checkpolicy.x86_64 0:2.5-8.el7 container-selinux.noarch 2:2.119.2-1.911c772.el7_8
libcgroup.x86_64 0:0.41-21.el7 libseccomp.x86_64 0:2.3.1-4.el7 libsemanage-python.x86_64 0:2.5-14.el7
libtool-ltdl.x86_64 0:2.4.2-22.el7_3 pigz.x86_64 0:2.3.3-1.el7.centos policycoreutils-python.x86_64 0:2.5-34.el7
python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.8-4.el7
Complete!
6,启动docker并检查版本信息
[root@i-AAB0CE27 yum.repos.d]# systemctl start docker
[root@i-AAB0CE27 yum.repos.d]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@i-AAB0CE27 yum.repos.d]# docker --version
Docker version 18.03.1-ce, build 9ee9f40