官网地址(For RHEL/CentOS 7.9):
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
20.10.23版本官方安装包如下:
# ls -ltr
总用量 109884
-rwxr-xr-x 1 root root 34561332 1月 21 22:34 containerd.io-1.6.15-3.1.el7.x86_64.rpm
-rwxr-xr-x 1 root root 22768452 1月 21 22:35 docker-ce-20.10.23-3.el7.x86_64.rpm
-rwxr-xr-x 1 root root 8882872 1月 21 22:35 docker-ce-rootless-extras-20.10.23-3.el7.x86_64.rpm
-rwxr-xr-x 1 root root 31528328 1月 21 22:35 docker-ce-cli-20.10.23-3.el7.x86_64.rpm
-rwxr-xr-x 1 root root 10763272 1月 21 22:35 docker-compose-plugin-2.15.1-3.el7.x86_64.rpm
-rwxr-xr-x 1 root root 4006940 1月 21 22:35 docker-scan-plugin-0.23.0-3.el7.x86_64.rpm
下载完以上的官方包以后,将上面的包上传到一台可以连接外网的CentOS7.9服务器上,然后使用下面的命令来下载依赖包。
# yum install -y *.rpm --downloadonly --downloaddir=./
已加载插件:fastestmirror, langpacks
正在检查 containerd.io-1.6.15-3.1.el7.x86_64.rpm: containerd.io-1.6.15-3.1.el7.x86_64
containerd.io-1.6.15-3.1.el7.x86_64.rpm 将被安装
正在检查 docker-ce-20.10.23-3.el7.x86_64.rpm: 3:docker-ce-20.10.23-3.el7.x86_64
docker-ce-20.10.23-3.el7.x86_64.rpm 将被安装
正在检查 docker-ce-cli-20.10.23-3.el7.x86_64.rpm: 1:docker-ce-cli-20.10.23-3.el7.x86_64
docker-ce-cli-20.10.23-3.el7.x86_64.rpm 将被安装
正在检查 docker-ce-rootless-extras-20.10.23-3.el7.x86_64.rpm: docker-ce-rootless-extras-20.10.23-3.el7.x86_64
docker-ce-rootless-extras-20.10.23-3.el7.x86_64.rpm 将被安装
正在检查 docker-compose-plugin-2.15.1-3.el7.x86_64.rpm: docker-compose-plugin-2.15.1-3.el7.x86_64
docker-compose-plugin-2.15.1-3.el7.x86_64.rpm 将被安装
正在检查 docker-scan-plugin-0.23.0-3.el7.x86_64.rpm: docker-scan-plugin-0.23.0-3.el7.x86_64
docker-scan-plugin-0.23.0-3.el7.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 containerd.io.x86_64.0.1.6.15-3.1.el7 将被 安装
--> 正在处理依赖关系 container-selinux >= 2:2.74,它被软件包 containerd.io-1.6.15-3.1.el7.x86_64 需要
Determining fastest mirrors
* base: ftp.sjtu.edu.cn
* extras: ftp.sjtu.edu.cn
* updates: ftp.sjtu.edu.cn
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
updates/7/x86_64/primary_db | 19 MB 00:00:14
---> 软件包 docker-ce.x86_64.3.20.10.23-3.el7 将被 安装
---> 软件包 docker-ce-cli.x86_64.1.20.10.23-3.el7 将被 安装
---> 软件包 docker-ce-rootless-extras.x86_64.0.20.10.23-3.el7 将被 安装
--> 正在处理依赖关系 fuse-overlayfs >= 0.7,它被软件包 docker-ce-rootless-extras-20.10.23-3.el7.x86_64 需要
--> 正在处理依赖关系 slirp4netns >= 0.4,它被软件包 docker-ce-rootless-extras-20.10.23-3.el7.x86_64 需要
---> 软件包 docker-compose-plugin.x86_64.0.2.15.1-3.el7 将被 安装
---> 软件包 docker-scan-plugin.x86_64.0.0.23.0-3.el7 将被 安装
--> 正在检查事务
---> 软件包 container-selinux.noarch.2.2.119.2-1.911c772.el7_8 将被 安装
---> 软件包 fuse-overlayfs.x86_64.0.0.7.2-6.el7_8 将被 安装
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.2)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.0)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3()(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
---> 软件包 slirp4netns.x86_64.0.0.4.3-4.el7_8 将被 安装
--> 正在检查事务
---> 软件包 fuse3-libs.x86_64.0.3.6.1-4.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=========================================================================================================================================================
Package 架构 版本 源 大小
=========================================================================================================================================================
正在安装:
containerd.io x86_64 1.6.15-3.1.el7 /containerd.io-1.6.15-3.1.el7.x86_64 112 M
docker-ce x86_64 3:20.10.23-3.el7 /docker-ce-20.10.23-3.el7.x86_64 84 M
docker-ce-cli x86_64 1:20.10.23-3.el7 /docker-ce-cli-20.10.23-3.el7.x86_64 131 M
docker-ce-rootless-extras x86_64 20.10.23-3.el7 /docker-ce-rootless-extras-20.10.23-3.el7.x86_64 18 M
docker-compose-plugin x86_64 2.15.1-3.el7 /docker-compose-plugin-2.15.1-3.el7.x86_64 43 M
docker-scan-plugin x86_64 0.23.0-3.el7 /docker-scan-plugin-0.23.0-3.el7.x86_64 12 M
为依赖而安装:
container-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 k
fuse-overlayfs x86_64 0.7.2-6.el7_8 extras 54 k
fuse3-libs x86_64 3.6.1-4.el7 extras 82 k
slirp4netns x86_64 0.4.3-4.el7_8 extras 81 k
事务概要
=========================================================================================================================================================
安装 6 软件包 (+4 依赖软件包)
总计:400 M
总下载量:258 k
安装大小:401 M
Background downloading packages, then exiting:
(1/4): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm | 40 kB 00:00:00
(2/4): fuse3-libs-3.6.1-4.el7.x86_64.rpm | 82 kB 00:00:00
(3/4): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm | 54 kB 00:00:00
(4/4): slirp4netns-0.4.3-4.el7_8.x86_64.rpm | 81 kB 00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------
总计 446 kB/s | 258 kB 00:00:00
exiting because "Download Only" specified
# ls -ltr
总用量 110148
-rw-r--r-- 1 root root 55796 4月 29 2020 fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
-rw-r--r-- 1 root root 83764 4月 29 2020 fuse3-libs-3.6.1-4.el7.x86_64.rpm
-rw-r--r-- 1 root root 83452 4月 29 2020 slirp4netns-0.4.3-4.el7_8.x86_64.rpm
-rw-r--r-- 1 root root 40816 7月 6 2020 container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
-rwxr-xr-x 1 root root 34561332 1月 21 22:34 containerd.io-1.6.15-3.1.el7.x86_64.rpm
-rwxr-xr-x 1 root root 22768452 1月 21 22:35 docker-ce-20.10.23-3.el7.x86_64.rpm
-rwxr-xr-x 1 root root 8882872 1月 21 22:35 docker-ce-rootless-extras-20.10.23-3.el7.x86_64.rpm
-rwxr-xr-x 1 root root 31528328 1月 21 22:35 docker-ce-cli-20.10.23-3.el7.x86_64.rpm
-rwxr-xr-x 1 root root 10763272 1月 21 22:35 docker-compose-plugin-2.15.1-3.el7.x86_64.rpm
-rwxr-xr-x 1 root root 4006940 1月 21 22:35 docker-scan-plugin-0.23.0-3.el7.x86_64.rpm
制作离线安装包
# cd ..
# tar -czf docker-ce-20.10.23-centos-rhel_7.9-offline-installer.tar.gz docker-ce
依赖包(4个)下载完成后,我们就可以将这个目录打包到任何CentOS或者Redaht 7.9版本的服务器上进行安装了。
# rpm -ivh *.rpm
警告:containerd.io-1.6.15-3.1.el7.x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 621e9f35: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:container-selinux-2:2.119.2-1.911################################# [ 10%]
setsebool: SELinux is disabled.
2:containerd.io-1.6.15-3.1.el7 ################################# [ 20%]
3:slirp4netns-0.4.3-4.el7_8 ################################# [ 30%]
4:fuse3-libs-3.6.1-4.el7 ################################# [ 40%]
5:fuse-overlayfs-0.7.2-6.el7_8 ################################# [ 50%]
6:docker-scan-plugin-0:0.23.0-3.el7################################# [ 60%]
7:docker-ce-cli-1:20.10.23-3.el7 ################################# [ 70%]
8:docker-ce-rootless-extras-0:20.10################################# [ 80%]
9:docker-ce-3:20.10.23-3.el7 ################################# [ 90%]
10:docker-compose-plugin-0:2.15.1-3.################################# [100%]
启动和运行docker服务:
# systemctl start docker.socket docker.service containerd.service
# systemctl status docker.socket docker.service containerd.service
● docker.socket - Docker Socket for the API
Loaded: loaded (/usr/lib/systemd/system/docker.socket; disabled; vendor preset: disabled)
Active: active (running) since 日 2023-01-22 15:03:32 CST; 7s ago
Listen: /var/run/docker.sock (Stream)
1月 22 15:03:32 middleware systemd[1]: Starting Docker Socket for the API.
1月 22 15:03:32 middleware systemd[1]: Listening on Docker Socket for the API.
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since 日 2023-01-22 15:03:34 CST; 5s ago
Docs: https://docs.docker.com
Main PID: 1911 (dockerd)
Tasks: 9
Memory: 28.4M
CGroup: /system.slice/docker.service
└─1911 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
1月 22 15:03:34 middleware dockerd[1911]: time="2023-01-22T15:03:34.112892542+08:00" level=info msg="scheme \"unix\" not registered, fallback...ule=grpc
1月 22 15:03:34 middleware dockerd[1911]: time="2023-01-22T15:03:34.112905882+08:00" level=info msg="ccResolverWrapper: sending update to cc:...ule=grpc
1月 22 15:03:34 middleware dockerd[1911]: time="2023-01-22T15:03:34.112912600+08:00" level=info msg="ClientConn switching balancer to \"pick_...ule=grpc
1月 22 15:03:34 middleware dockerd[1911]: time="2023-01-22T15:03:34.131645222+08:00" level=info msg="Loading containers: start."
1月 22 15:03:34 middleware dockerd[1911]: time="2023-01-22T15:03:34.373339800+08:00" level=info msg="Default bridge (docker0) is assigned wit...address"
1月 22 15:03:34 middleware dockerd[1911]: time="2023-01-22T15:03:34.435408778+08:00" level=info msg="Loading containers: done."
1月 22 15:03:34 middleware dockerd[1911]: time="2023-01-22T15:03:34.493811921+08:00" level=info msg="Docker daemon" commit=6051f14 graphdrive...20.10.23
1月 22 15:03:34 middleware dockerd[1911]: time="2023-01-22T15:03:34.494008181+08:00" level=info msg="Daemon has completed initialization"
1月 22 15:03:34 middleware systemd[1]: Started Docker Application Container Engine.
1月 22 15:03:34 middleware dockerd[1911]: time="2023-01-22T15:03:34.537527089+08:00" level=info msg="API listen on /var/run/docker.sock"
● containerd.service - containerd container runtime
Loaded: loaded (/usr/lib/systemd/system/containerd.service; disabled; vendor preset: disabled)
Active: active (running) since 日 2023-01-22 15:03:33 CST; 6s ago
Docs: https://containerd.io
Process: 1895 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
Main PID: 1899 (containerd)
Tasks: 10
Memory: 20.0M
CGroup: /system.slice/containerd.service
└─1899 /usr/bin/containerd
1月 22 15:03:33 middleware containerd[1899]: time="2023-01-22T15:03:33.856647719+08:00" level=info msg="loading plugin \"io.containerd.grpc.v....grpc.v1
1月 22 15:03:33 middleware containerd[1899]: time="2023-01-22T15:03:33.856689993+08:00" level=info msg="loading plugin \"io.containerd.grpc.v....grpc.v1
1月 22 15:03:33 middleware containerd[1899]: time="2023-01-22T15:03:33.856713208+08:00" level=info msg="loading plugin \"io.containerd.grpc.v....grpc.v1
1月 22 15:03:33 middleware containerd[1899]: time="2023-01-22T15:03:33.856732774+08:00" level=info msg="loading plugin \"io.containerd.tracin...essor.v1
1月 22 15:03:33 middleware containerd[1899]: time="2023-01-22T15:03:33.856760334+08:00" level=info msg="skip loading plugin \"io.containerd.t...essor.v1
1月 22 15:03:33 middleware containerd[1899]: time="2023-01-22T15:03:33.856780251+08:00" level=info msg="loading plugin \"io.containerd.intern...ernal.v1
1月 22 15:03:33 middleware containerd[1899]: time="2023-01-22T15:03:33.856828064+08:00" level=error msg="failed to initialize a tracing proce... plugin"
1月 22 15:03:33 middleware containerd[1899]: time="2023-01-22T15:03:33.857259810+08:00" level=info msg=serving... address=/run/containerd/con...ck.ttrpc
1月 22 15:03:33 middleware containerd[1899]: time="2023-01-22T15:03:33.857317682+08:00" level=info msg=serving... address=/run/containerd/con...erd.sock
1月 22 15:03:33 middleware containerd[1899]: time="2023-01-22T15:03:33.857437641+08:00" level=info msg="containerd successfully booted in 0.070380s"
Hint: Some lines were ellipsized, use -l to show in full.
检查docker版本信息:
# docker version
Client: Docker Engine - Community
Version: 20.10.23
API version: 1.41
Go version: go1.18.10
Git commit: 7155243
Built: Thu Jan 19 17:36:21 2023
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.23
API version: 1.41 (minimum version 1.12)
Go version: go1.18.10
Git commit: 6051f14
Built: Thu Jan 19 17:34:26 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.15
GitCommit: 5b842e528e99d4d4c1686467debf2bd4b88ecd86
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.10.0-docker)
compose: Docker Compose (Docker Inc., v2.15.1)
scan: Docker Scan (Docker Inc., v0.23.0)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.23
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.runtime.v1.linux runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 5b842e528e99d4d4c1686467debf2bd4b88ecd86
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: 3.84GiB
Name: middleware
ID: M35P:3ZMB:YT6G:YCIU:BSMB:DFPX:L7BT:FMP7:VGOX:5HKD:VVV6:PLIL
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