官网地址(For RHEL/CentOS 7.9):
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
20.10.18版本官方发布安装包下载:
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.6.8-3.1.el7.x86_64.rpm
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-20.10.18-3.el7.x86_64.rpm
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-20.10.18-3.el7.x86_64.rpm
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-rootless-extras-20.10.18-3.el7.x86_64.rpm
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-compose-plugin-2.10.2-3.el7.x86_64.rpm
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-scan-plugin-0.17.0-3.el7.x86_64.rpm
下载完以上的官方包以后,将上面的包上传到一台可以连接外网的CentOS7.9服务器上,然后使用下面的命令来下载依赖包。
# yum install -y --downloadonly --downloaddir=./ *.rpm
# ls -ltr
total 108076
-rw-r--r-- 1 root root 32880 Jul 4 2014 python-IPy-0.75-6.el7.noarch.rpm
-rw-r--r-- 1 root root 302068 Nov 12 2018 checkpolicy-2.5-8.el7.x86_64.rpm
-rw-r--r-- 1 root root 115284 Nov 12 2018 libsemanage-python-2.5-14.el7.x86_64.rpm
-rw-r--r-- 1 root root 635184 Nov 12 2018 setools-libs-3.3.8-4.el7.x86_64.rpm
-rw-r--r-- 1 root root 78256 Aug 23 2019 audit-libs-python-2.8.5-4.el7.x86_64.rpm
-rw-r--r-- 1 root root 67720 Aug 23 2019 libcgroup-0.41-21.el7.x86_64.rpm
-rw-r--r-- 1 root root 468316 Apr 4 2020 policycoreutils-python-2.5-34.el7.x86_64.rpm
-rw-r--r-- 1 root root 55796 Apr 29 2020 fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
-rw-r--r-- 1 root root 83764 Apr 29 2020 fuse3-libs-3.6.1-4.el7.x86_64.rpm
-rw-r--r-- 1 root root 83452 Apr 29 2020 slirp4netns-0.4.3-4.el7_8.x86_64.rpm
-rw-r--r-- 1 root root 40816 Jul 6 2020 container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
-rw-r--r-- 1 root root 8878344 Sep 13 2022 docker-ce-rootless-extras-20.10.18-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 34677060 Sep 13 2022 containerd.io-1.6.8-3.1.el7.x86_64.rpm
-rw-r--r-- 1 root root 7527268 Sep 13 2022 docker-compose-plugin-2.10.2-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 3930044 Sep 13 2022 docker-scan-plugin-0.17.0-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 22666600 Sep 13 2022 docker-ce-20.10.18-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 30988356 Sep 13 2022 docker-ce-cli-20.10.18-3.el7.x86_64.rpm
# ls | wc -l
17
依赖包下载完成后,我们就可以将这个目录打包到任何CentOS或者Redaht 7.9版本的服务器上进行安装了。
# yum install -y *.rpm
Loaded plugins: fastestmirror, langpacks
Examining audit-libs-python-2.8.5-4.el7.x86_64.rpm: audit-libs-python-2.8.5-4.el7.x86_64
Marking audit-libs-python-2.8.5-4.el7.x86_64.rpm to be installed
Examining checkpolicy-2.5-8.el7.x86_64.rpm: checkpolicy-2.5-8.el7.x86_64
Marking checkpolicy-2.5-8.el7.x86_64.rpm to be installed
Examining containerd.io-1.6.8-3.1.el7.x86_64.rpm: containerd.io-1.6.8-3.1.el7.x86_64
Marking containerd.io-1.6.8-3.1.el7.x86_64.rpm to be installed
Examining container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm: 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
Marking container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm to be installed
Examining docker-ce-20.10.18-3.el7.x86_64.rpm: 3:docker-ce-20.10.18-3.el7.x86_64
Marking docker-ce-20.10.18-3.el7.x86_64.rpm to be installed
Examining docker-ce-cli-20.10.18-3.el7.x86_64.rpm: 1:docker-ce-cli-20.10.18-3.el7.x86_64
Marking docker-ce-cli-20.10.18-3.el7.x86_64.rpm to be installed
Examining docker-ce-rootless-extras-20.10.18-3.el7.x86_64.rpm: docker-ce-rootless-extras-20.10.18-3.el7.x86_64
Marking docker-ce-rootless-extras-20.10.18-3.el7.x86_64.rpm to be installed
Examining docker-compose-plugin-2.10.2-3.el7.x86_64.rpm: docker-compose-plugin-2.10.2-3.el7.x86_64
Marking docker-compose-plugin-2.10.2-3.el7.x86_64.rpm to be installed
Examining docker-scan-plugin-0.17.0-3.el7.x86_64.rpm: docker-scan-plugin-0.17.0-3.el7.x86_64
Marking docker-scan-plugin-0.17.0-3.el7.x86_64.rpm to be installed
Examining fuse3-libs-3.6.1-4.el7.x86_64.rpm: fuse3-libs-3.6.1-4.el7.x86_64
Marking fuse3-libs-3.6.1-4.el7.x86_64.rpm to be installed
Examining fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm: fuse-overlayfs-0.7.2-6.el7_8.x86_64
Marking fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm to be installed
Examining libcgroup-0.41-21.el7.x86_64.rpm: libcgroup-0.41-21.el7.x86_64
Marking libcgroup-0.41-21.el7.x86_64.rpm to be installed
Examining libsemanage-python-2.5-14.el7.x86_64.rpm: libsemanage-python-2.5-14.el7.x86_64
Marking libsemanage-python-2.5-14.el7.x86_64.rpm to be installed
Examining policycoreutils-python-2.5-34.el7.x86_64.rpm: policycoreutils-python-2.5-34.el7.x86_64
Marking policycoreutils-python-2.5-34.el7.x86_64.rpm to be installed
Examining python-IPy-0.75-6.el7.noarch.rpm: python-IPy-0.75-6.el7.noarch
Marking python-IPy-0.75-6.el7.noarch.rpm to be installed
Examining setools-libs-3.3.8-4.el7.x86_64.rpm: setools-libs-3.3.8-4.el7.x86_64
Marking setools-libs-3.3.8-4.el7.x86_64.rpm to be installed
Examining slirp4netns-0.4.3-4.el7_8.x86_64.rpm: slirp4netns-0.4.3-4.el7_8.x86_64
Marking slirp4netns-0.4.3-4.el7_8.x86_64.rpm to be installed
Resolving Dependencies
--> 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 container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
---> Package containerd.io.x86_64 0:1.6.8-3.1.el7 will be installed
---> Package docker-ce.x86_64 3:20.10.18-3.el7 will be installed
---> Package docker-ce-cli.x86_64 1:20.10.18-3.el7 will be installed
---> Package docker-ce-rootless-extras.x86_64 0:20.10.18-3.el7 will be installed
---> Package docker-compose-plugin.x86_64 0:2.10.2-3.el7 will be installed
---> Package docker-scan-plugin.x86_64 0:0.17.0-3.el7 will be installed
---> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed
---> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package policycoreutils-python.x86_64 0:2.5-34.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
---> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================
Installing:
audit-libs-python x86_64 2.8.5-4.el7 /audit-libs-python-2.8.5-4.el7.x86_64 316 k
checkpolicy x86_64 2.5-8.el7 /checkpolicy-2.5-8.el7.x86_64 1.2 M
container-selinux noarch 2:2.119.2-1.911c772.el7_8 /container-selinux-2.119.2-1.911c772.el7_8.noarch 41 k
containerd.io x86_64 1.6.8-3.1.el7 /containerd.io-1.6.8-3.1.el7.x86_64 125 M
docker-ce x86_64 3:20.10.18-3.el7 /docker-ce-20.10.18-3.el7.x86_64 84 M
docker-ce-cli x86_64 1:20.10.18-3.el7 /docker-ce-cli-20.10.18-3.el7.x86_64 129 M
docker-ce-rootless-extras x86_64 20.10.18-3.el7 /docker-ce-rootless-extras-20.10.18-3.el7.x86_64 18 M
docker-compose-plugin x86_64 2.10.2-3.el7 /docker-compose-plugin-2.10.2-3.el7.x86_64 25 M
docker-scan-plugin x86_64 0.17.0-3.el7 /docker-scan-plugin-0.17.0-3.el7.x86_64 13 M
fuse-overlayfs x86_64 0.7.2-6.el7_8 /fuse-overlayfs-0.7.2-6.el7_8.x86_64 116 k
fuse3-libs x86_64 3.6.1-4.el7 /fuse3-libs-3.6.1-4.el7.x86_64 270 k
libcgroup x86_64 0.41-21.el7 /libcgroup-0.41-21.el7.x86_64 134 k
libsemanage-python x86_64 2.5-14.el7 /libsemanage-python-2.5-14.el7.x86_64 441 k
policycoreutils-python x86_64 2.5-34.el7 /policycoreutils-python-2.5-34.el7.x86_64 1.2 M
python-IPy noarch 0.75-6.el7 /python-IPy-0.75-6.el7.noarch 119 k
setools-libs x86_64 3.3.8-4.el7 /setools-libs-3.3.8-4.el7.x86_64 1.8 M
slirp4netns x86_64 0.4.3-4.el7_8 /slirp4netns-0.4.3-4.el7_8.x86_64 169 k
Transaction Summary
===============================================================================================================================================================================================================
Install 17 Packages
Total size: 399 M
Installed size: 399 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : docker-scan-plugin-0.17.0-3.el7.x86_64 1/17
Installing : 1:docker-ce-cli-20.10.18-3.el7.x86_64 2/17
Installing : libcgroup-0.41-21.el7.x86_64 3/17
Installing : setools-libs-3.3.8-4.el7.x86_64 4/17
Installing : audit-libs-python-2.8.5-4.el7.x86_64 5/17
Installing : slirp4netns-0.4.3-4.el7_8.x86_64 6/17
Installing : libsemanage-python-2.5-14.el7.x86_64 7/17
Installing : python-IPy-0.75-6.el7.noarch 8/17
Installing : fuse3-libs-3.6.1-4.el7.x86_64 9/17
Installing : fuse-overlayfs-0.7.2-6.el7_8.x86_64 10/17
Installing : checkpolicy-2.5-8.el7.x86_64 11/17
Installing : policycoreutils-python-2.5-34.el7.x86_64 12/17
Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 13/17
setsebool: SELinux is disabled.
Installing : containerd.io-1.6.8-3.1.el7.x86_64 14/17
Installing : docker-ce-rootless-extras-20.10.18-3.el7.x86_64 15/17
Installing : 3:docker-ce-20.10.18-3.el7.x86_64 16/17
Installing : docker-compose-plugin-2.10.2-3.el7.x86_64 17/17
Verifying : checkpolicy-2.5-8.el7.x86_64 1/17
Verifying : fuse3-libs-3.6.1-4.el7.x86_64 2/17
Verifying : containerd.io-1.6.8-3.1.el7.x86_64 3/17
Verifying : python-IPy-0.75-6.el7.noarch 4/17
Verifying : docker-ce-rootless-extras-20.10.18-3.el7.x86_64 5/17
Verifying : fuse-overlayfs-0.7.2-6.el7_8.x86_64 6/17
Verifying : libsemanage-python-2.5-14.el7.x86_64 7/17
Verifying : 3:docker-ce-20.10.18-3.el7.x86_64 8/17
Verifying : slirp4netns-0.4.3-4.el7_8.x86_64 9/17
Verifying : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 10/17
Verifying : policycoreutils-python-2.5-34.el7.x86_64 11/17
Verifying : 1:docker-ce-cli-20.10.18-3.el7.x86_64 12/17
Verifying : docker-scan-plugin-0.17.0-3.el7.x86_64 13/17
Verifying : audit-libs-python-2.8.5-4.el7.x86_64 14/17
Verifying : setools-libs-3.3.8-4.el7.x86_64 15/17
Verifying : docker-compose-plugin-2.10.2-3.el7.x86_64 16/17
Verifying : libcgroup-0.41-21.el7.x86_64 17/17
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 containerd.io.x86_64 0:1.6.8-3.1.el7
docker-ce.x86_64 3:20.10.18-3.el7 docker-ce-cli.x86_64 1:20.10.18-3.el7 docker-ce-rootless-extras.x86_64 0:20.10.18-3.el7 docker-compose-plugin.x86_64 0:2.10.2-3.el7
docker-scan-plugin.x86_64 0:0.17.0-3.el7 fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 fuse3-libs.x86_64 0:3.6.1-4.el7 libcgroup.x86_64 0:0.41-21.el7
libsemanage-python.x86_64 0:2.5-14.el7 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
slirp4netns.x86_64 0:0.4.3-4.el7_8
Complete!
启动docker服务,并设置为开机自启动。
# systemctl start docker.service
# systemctl enable docker.service
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-09-12 21:40:11 EDT; 11min ago
Docs: https://docs.docker.com
Main PID: 47954 (dockerd)
CGroup: /system.slice/docker.service
└─47954 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Sep 12 21:40:11 docker-ce dockerd[47954]: time="2022-09-12T21:40:11.158643265-04:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Sep 12 21:40:11 docker-ce dockerd[47954]: time="2022-09-12T21:40:11.158658335-04:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock <nil>...}" module=grpc
Sep 12 21:40:11 docker-ce dockerd[47954]: time="2022-09-12T21:40:11.158665919-04:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Sep 12 21:40:11 docker-ce dockerd[47954]: time="2022-09-12T21:40:11.171084428-04:00" level=info msg="Loading containers: start."
Sep 12 21:40:11 docker-ce dockerd[47954]: time="2022-09-12T21:40:11.445522038-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bi...ed IP address"
Sep 12 21:40:11 docker-ce dockerd[47954]: time="2022-09-12T21:40:11.517612385-04:00" level=info msg="Loading containers: done."
Sep 12 21:40:11 docker-ce dockerd[47954]: time="2022-09-12T21:40:11.541448275-04:00" level=info msg="Docker daemon" commit=e42327a graphdriver(s)=overlay2 version=20.10.18
Sep 12 21:40:11 docker-ce dockerd[47954]: time="2022-09-12T21:40:11.541564755-04:00" level=info msg="Daemon has completed initialization"
Sep 12 21:40:11 docker-ce systemd[1]: Started Docker Application Container Engine.
Sep 12 21:40:11 docker-ce dockerd[47954]: time="2022-09-12T21:40:11.562330822-04:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
查看docker-ce的版本信息:
# docker version
Client: Docker Engine - Community
Version: 20.10.18
API version: 1.41
Go version: go1.18.6
Git commit: b40c2f6
Built: Thu Sep 8 23:14:08 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.18
API version: 1.41 (minimum version 1.12)
Go version: go1.18.6
Git commit: e42327a
Built: Thu Sep 8 23:12:21 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
# docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
compose: Docker Compose (Docker Inc., v2.10.2)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.18
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-1160.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.777GiB
Name: docker-ce
ID: UTDW:DI2G:VDDU:PSAG:47HJ:UC7D:SP46:N73U:BQBH:XIUI:KDJT:5KUG
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false