以Cento是7.5安装docker为例,首先需要在可联网的服务器或者虚拟机下载相关依赖,将依赖拷贝至离线服务器再安装。
可联网的服务器或者虚拟机配置docker源
官方源:https://download.docker.com/linux/centos/docker-ce.repo
[root@bogon /]# curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
[root@bogon /]#yum clean all
[root@bogon /]#yum makecache
yum自动下载docker相关依赖包
[root@bogon /]# yum install --downloaddir=/home/temp/docker --downloadonly docker-ce-19.03.8-3.el7.x86_64
将依赖拷贝至离线服务器对应目录
cd 进离线服务器对应目录使用sudo yum localinstall xxx 安装,将所有依赖包都加上,以空格隔开:
[root@bogon docker]# sudo yum localinstall containerd.io-1.6.21-3.1.el7.x86_64.rpm container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm docker-buildx-plugin-0.11.1-1.el7.x86_64.rpm docker-ce-19.03.8-3.el7.x86_64.rpm docker-ce-cli-24.0.3-1.el7.x86_64.rpm docker-compose-plugin-2.19.1-1.el7.x86_64.rpm libselinux-python-2.5-15.el7.x86_64.rpm libselinux-utils-2.5-15.el7.x86_64.rpm libsemanage-2.5-14.el7.x86_64.rpm libsemanage-python-2.5-14.el7.x86_64.rpm policycoreutils-2.5-34.el7.x86_64.rpm policycoreutils-python-2.5-34.el7.x86_64.rpm selinux-policy-3.13.1-268.el7_9.2.noarch.rpm selinux-policy-targeted-3.13.1-268.el7_9.2.noarch.rpm setools-libs-3.3.8-4.el7.x86_64.rpm libsepol-2.5-10.el7.x86_64.rpm libselinux-2.5-15.el7.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining containerd.io-1.6.21-3.1.el7.x86_64.rpm: containerd.io-1.6.21-3.1.el7.x86_64
Marking containerd.io-1.6.21-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-buildx-plugin-0.11.1-1.el7.x86_64.rpm: docker-buildx-plugin-0.11.1-1.el7.x86_64
Marking docker-buildx-plugin-0.11.1-1.el7.x86_64.rpm to be installed
Examining docker-ce-19.03.8-3.el7.x86_64.rpm: 3:docker-ce-19.03.8-3.el7.x86_64
Marking docker-ce-19.03.8-3.el7.x86_64.rpm to be installed
Examining docker-ce-cli-24.0.3-1.el7.x86_64.rpm: 1:docker-ce-cli-24.0.3-1.el7.x86_64
Marking docker-ce-cli-24.0.3-1.el7.x86_64.rpm to be installed
Examining docker-compose-plugin-2.19.1-1.el7.x86_64.rpm: docker-compose-plugin-2.19.1-1.el7.x86_64
Marking docker-compose-plugin-2.19.1-1.el7.x86_64.rpm to be installed
Examining libselinux-python-2.5-15.el7.x86_64.rpm: libselinux-python-2.5-15.el7.x86_64
Marking libselinux-python-2.5-15.el7.x86_64.rpm as an update to libselinux-python-2.5-12.el7.x86_64
Examining libselinux-utils-2.5-15.el7.x86_64.rpm: libselinux-utils-2.5-15.el7.x86_64
Marking libselinux-utils-2.5-15.el7.x86_64.rpm as an update to libselinux-utils-2.5-12.el7.x86_64
Examining libsemanage-2.5-14.el7.x86_64.rpm: libsemanage-2.5-14.el7.x86_64
Marking libsemanage-2.5-14.el7.x86_64.rpm as an update to libsemanage-2.5-11.el7.x86_64
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 as an update to libsemanage-python-2.5-11.el7.x86_64
Examining policycoreutils-2.5-34.el7.x86_64.rpm: policycoreutils-2.5-34.el7.x86_64
Marking policycoreutils-2.5-34.el7.x86_64.rpm as an update to policycoreutils-2.5-22.el7.x86_64
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 as an update to policycoreutils-python-2.5-22.el7.x86_64
Examining selinux-policy-3.13.1-268.el7_9.2.noarch.rpm: selinux-policy-3.13.1-268.el7_9.2.noarch
Marking selinux-policy-3.13.1-268.el7_9.2.noarch.rpm as an update to selinux-policy-3.13.1-192.el7.noarch
Examining selinux-policy-targeted-3.13.1-268.el7_9.2.noarch.rpm: selinux-policy-targeted-3.13.1-268.el7_9.2.noarch
Marking selinux-policy-targeted-3.13.1-268.el7_9.2.noarch.rpm as an update to selinux-policy-targeted-3.13.1-192.el7.noarch
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 as an update to setools-libs-3.3.8-2.el7.x86_64
Examining libsepol-2.5-10.el7.x86_64.rpm: libsepol-2.5-10.el7.x86_64
libsepol-2.5-10.el7.x86_64.rpm: does not update installed package.
Examining libselinux-2.5-15.el7.x86_64.rpm: libselinux-2.5-15.el7.x86_64
Marking libselinux-2.5-15.el7.x86_64.rpm as an update to libselinux-2.5-12.el7.x86_64
Resolving Dependencies
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
---> Package containerd.io.x86_64 0:1.6.21-3.1.el7 will be installed
---> Package docker-buildx-plugin.x86_64 0:0.11.1-1.el7 will be installed
---> Package docker-ce.x86_64 3:19.03.8-3.el7 will be installed
---> Package docker-ce-cli.x86_64 1:24.0.3-1.el7 will be installed
---> Package docker-compose-plugin.x86_64 0:2.19.1-1.el7 will be installed
---> Package libselinux.x86_64 0:2.5-12.el7 will be updated
---> Package libselinux.x86_64 0:2.5-15.el7 will be an update
---> Package libselinux-python.x86_64 0:2.5-12.el7 will be updated
---> Package libselinux-python.x86_64 0:2.5-15.el7 will be an update
---> Package libselinux-utils.x86_64 0:2.5-12.el7 will be updated
---> Package libselinux-utils.x86_64 0:2.5-15.el7 will be an update
---> Package libsemanage.x86_64 0:2.5-11.el7 will be updated
---> Package libsemanage.x86_64 0:2.5-14.el7 will be an update
---> Package libsemanage-python.x86_64 0:2.5-11.el7 will be updated
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be an update
---> Package policycoreutils.x86_64 0:2.5-22.el7 will be updated
---> Package policycoreutils.x86_64 0:2.5-34.el7 will be an update
---> Package policycoreutils-python.x86_64 0:2.5-22.el7 will be updated
---> Package policycoreutils-python.x86_64 0:2.5-34.el7 will be an update
---> Package selinux-policy.noarch 0:3.13.1-192.el7 will be updated
---> Package selinux-policy.noarch 0:3.13.1-268.el7_9.2 will be an update
---> Package selinux-policy-targeted.noarch 0:3.13.1-192.el7 will be updated
---> Package selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2 will be an update
---> Package setools-libs.x86_64 0:3.3.8-2.el7 will be updated
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================
Package Arch Version Repository Size
================================================================================================================
Installing:
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.21-3.1.el7 /containerd.io-1.6.21-3.1.el7.x86_64 114 M
docker-buildx-plugin x86_64 0.11.1-1.el7 /docker-buildx-plugin-0.11.1-1.el7.x86_64 59 M
docker-ce x86_64 3:19.03.8-3.el7 /docker-ce-19.03.8-3.el7.x86_64 104 M
docker-ce-cli x86_64 1:24.0.3-1.el7 /docker-ce-cli-24.0.3-1.el7.x86_64 35 M
docker-compose-plugin x86_64 2.19.1-1.el7 /docker-compose-plugin-2.19.1-1.el7.x86_64 58 M
Updating:
libselinux x86_64 2.5-15.el7 /libselinux-2.5-15.el7.x86_64 213 k
libselinux-python x86_64 2.5-15.el7 /libselinux-python-2.5-15.el7.x86_64 589 k
libselinux-utils x86_64 2.5-15.el7 /libselinux-utils-2.5-15.el7.x86_64 172 k
libsemanage x86_64 2.5-14.el7 /libsemanage-2.5-14.el7.x86_64 295 k
libsemanage-python x86_64 2.5-14.el7 /libsemanage-python-2.5-14.el7.x86_64 441 k
policycoreutils x86_64 2.5-34.el7 /policycoreutils-2.5-34.el7.x86_64 5.1 M
policycoreutils-python x86_64 2.5-34.el7 /policycoreutils-python-2.5-34.el7.x86_64 1.2 M
selinux-policy noarch 3.13.1-268.el7_9.2 /selinux-policy-3.13.1-268.el7_9.2.noarch 6.7 k
selinux-policy-targeted noarch 3.13.1-268.el7_9.2 /selinux-policy-targeted-3.13.1-268.el7_9.2.noarch 19 M
setools-libs x86_64 3.3.8-4.el7 /setools-libs-3.3.8-4.el7.x86_64 1.8 M
Transaction Summary
================================================================================================================
Install 6 Packages
Upgrade 10 Packages
Total size: 399 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Updating : libselinux-2.5-15.el7.x86_64 1/26
Updating : libsemanage-2.5-14.el7.x86_64 2/26
Updating : libselinux-utils-2.5-15.el7.x86_64 3/26
Updating : policycoreutils-2.5-34.el7.x86_64 4/26
Updating : selinux-policy-3.13.1-268.el7_9.2.noarch 5/26
Updating : selinux-policy-targeted-3.13.1-268.el7_9.2.noarch 6/26
Updating : libsemanage-python-2.5-14.el7.x86_64 7/26
Updating : libselinux-python-2.5-15.el7.x86_64 8/26
Updating : setools-libs-3.3.8-4.el7.x86_64 9/26
Updating : policycoreutils-python-2.5-34.el7.x86_64 10/26
Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 11/26
Installing : containerd.io-1.6.21-3.1.el7.x86_64 12/26
Installing : docker-compose-plugin-2.19.1-1.el7.x86_64 13/26
Installing : docker-buildx-plugin-0.11.1-1.el7.x86_64 14/26
Installing : 1:docker-ce-cli-24.0.3-1.el7.x86_64 15/26
Installing : 3:docker-ce-19.03.8-3.el7.x86_64 16/26
Cleanup : selinux-policy-targeted-3.13.1-192.el7.noarch 17/26
Cleanup : policycoreutils-python-2.5-22.el7.x86_64 18/26
Cleanup : selinux-policy-3.13.1-192.el7.noarch 19/26
Cleanup : policycoreutils-2.5-22.el7.x86_64 20/26
Cleanup : libselinux-utils-2.5-12.el7.x86_64 21/26
Cleanup : setools-libs-3.3.8-2.el7.x86_64 22/26
Cleanup : libselinux-python-2.5-12.el7.x86_64 23/26
Cleanup : libsemanage-python-2.5-11.el7.x86_64 24/26
Cleanup : libsemanage-2.5-11.el7.x86_64 25/26
Cleanup : libselinux-2.5-12.el7.x86_64 26/26
Verifying : docker-buildx-plugin-0.11.1-1.el7.x86_64 1/26
Verifying : 1:docker-ce-cli-24.0.3-1.el7.x86_64 2/26
Verifying : containerd.io-1.6.21-3.1.el7.x86_64 3/26
Verifying : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 4/26
Verifying : selinux-policy-targeted-3.13.1-268.el7_9.2.noarch 5/26
Verifying : policycoreutils-2.5-34.el7.x86_64 6/26
Verifying : libselinux-utils-2.5-15.el7.x86_64 7/26
Verifying : policycoreutils-python-2.5-34.el7.x86_64 8/26
Verifying : libselinux-2.5-15.el7.x86_64 9/26
Verifying : libsemanage-python-2.5-14.el7.x86_64 10/26
Verifying : libsemanage-2.5-14.el7.x86_64 11/26
Verifying : libselinux-python-2.5-15.el7.x86_64 12/26
Verifying : 3:docker-ce-19.03.8-3.el7.x86_64 13/26
Verifying : selinux-policy-3.13.1-268.el7_9.2.noarch 14/26
Verifying : docker-compose-plugin-2.19.1-1.el7.x86_64 15/26
Verifying : setools-libs-3.3.8-4.el7.x86_64 16/26
Verifying : libsemanage-python-2.5-11.el7.x86_64 17/26
Verifying : libsemanage-2.5-11.el7.x86_64 18/26
Verifying : libselinux-python-2.5-12.el7.x86_64 19/26
Verifying : setools-libs-3.3.8-2.el7.x86_64 20/26
Verifying : policycoreutils-2.5-22.el7.x86_64 21/26
Verifying : policycoreutils-python-2.5-22.el7.x86_64 22/26
Verifying : selinux-policy-targeted-3.13.1-192.el7.noarch 23/26
Verifying : selinux-policy-3.13.1-192.el7.noarch 24/26
Verifying : libselinux-2.5-12.el7.x86_64 25/26
Verifying : libselinux-utils-2.5-12.el7.x86_64 26/26
Installed:
container-selinux.noarch 2:2.119.2-1.911c772.el7_8 containerd.io.x86_64 0:1.6.21-3.1.el7
docker-buildx-plugin.x86_64 0:0.11.1-1.el7 docker-ce.x86_64 3:19.03.8-3.el7
docker-ce-cli.x86_64 1:24.0.3-1.el7 docker-compose-plugin.x86_64 0:2.19.1-1.el7
Updated:
libselinux.x86_64 0:2.5-15.el7 libselinux-python.x86_64 0:2.5-15.el7
libselinux-utils.x86_64 0:2.5-15.el7 libsemanage.x86_64 0:2.5-14.el7
libsemanage-python.x86_64 0:2.5-14.el7 policycoreutils.x86_64 0:2.5-34.el7
policycoreutils-python.x86_64 0:2.5-34.el7 selinux-policy.noarch 0:3.13.1-268.el7_9.2
selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2 setools-libs.x86_64 0:3.3.8-4.el7
Complete!
查看dockers版本情况
[root@bogon docker]# docker version
Client: Docker Engine - Community
Version: 24.0.3
API version: 1.43
Go version: go1.20.5
Git commit: 3713ee1
Built: Wed Jul 5 20:48:25 2023
OS/Arch: linux/amd64
Context: default
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
查看docker运行情况,发现没运行
[root@bogon docker]# sudo service docker status
Redirecting to /bin/systemctl status docker.service
鈼?docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: https://docs.docker.com
启动dockers:systemctl start docker文章来源:https://www.toymoban.com/news/detail-770557.html
再次查看版本信息,dockers已启动文章来源地址https://www.toymoban.com/news/detail-770557.html
[root@bogon docker]# docker version
Client: Docker Engine - Community
Version: 24.0.3
API version: 1.40 (downgraded from 1.43)
Go version: go1.20.5
Git commit: 3713ee1
Built: Wed Jul 5 20:48:25 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:25:42 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.21
GitCommit: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc:
Version: 1.1.7
GitCommit: v1.1.7-0-g860f061
docker-init:
Version: 0.18.0
GitCommit: fec3683
到了这里,关于Linux docker依赖离线安装的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!