CentOS7离线部署docker
更新:HHH   时间:2023-1-7


这篇文章主要介绍“CentOS7离线部署docker”,在日常操作中,相信很多人在CentOS7离线部署docker问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”CentOS7离线部署docker”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

1、环境准备

系统环境为: CentOS Linux release 7.5.1804 (Core)

安装docker版本为: 17.12.0-ce

2、准备部署文件

在http://mirrors.163.com/centos/7/os/x86_64/Packages/中下载如下rpm安装包:

audit-2.8.4-4.el7.x86_64.rpm
audit-libs-2.8.4-4.el7.x86_64.rpm
libselinux-2.5-14.1.el7.x86_64.rpm
libselinux-python-2.5-14.1.el7.x86_64.rpm
libselinux-utils-2.5-14.1.el7.x86_64.rpm
libsemanage-2.5-14.el7.x86_64.rpm
libsepol-2.5-10.el7.x86_64.rpm
policycoreutils-2.5-29.el7.x86_64.rpm
audit-libs-python-2.8.4-4.el7.x86_64.rpm
checkpolicy-2.5-8.el7.x86_64.rpm
libcgroup-0.41-20.el7.x86_64.rpm
libsemanage-python-2.5-14.el7.x86_64.rpm
libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm
policycoreutils-python-2.5-29.el7.x86_64.rpm
python-IPy-0.75-6.el7.noarch.rpm
setools-libs-3.3.8-4.el7.x86_64.rpm

在https://download.docker.com/linux/centos/7/x86_64/stable/Packages/中下载docker的安装包:

docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm

在http://rpm.pbone.net/index.php3/stat/4/idpl/36266349/dir/scientific_linux_7/com/container-selinux-2.9-4.el7.noarch.rpm.html中下载container-selinux安装包:

container-selinux-2.9-4.el7.noarch.rpm

经测试本系统中有些rpm安装包是需要update,有些是要install,为此将上述的rpm包分成update_rpm和install_rpm,其中: update_rpm中的rpm有:

audit-2.8.4-4.el7.x86_64.rpm
audit-libs-2.8.4-4.el7.x86_64.rpm
libselinux-2.5-14.1.el7.x86_64.rpm
libselinux-python-2.5-14.1.el7.x86_64.rpm
libselinux-utils-2.5-14.1.el7.x86_64.rpm
libsemanage-2.5-14.el7.x86_64.rpm
libsepol-2.5-10.el7.x86_64.rpm
policycoreutils-2.5-29.el7.x86_64.rpm

install_rpm中的rpm有:

audit-libs-python-2.8.4-4.el7.x86_64.rpm
checkpolicy-2.5-8.el7.x86_64.rpm
container-selinux-2.9-4.el7.noarch.rpm
docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm
libcgroup-0.41-20.el7.x86_64.rpm
libsemanage-python-2.5-14.el7.x86_64.rpm
libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm
policycoreutils-python-2.5-29.el7.x86_64.rpm
python-IPy-0.75-6.el7.noarch.rpm
setools-libs-3.3.8-4.el7.x86_64.rpm

3、安装docker

首先更新需要更新rpm,即执行如下命令:

rpm -Uvh update_rpm/*.rpm

安装需要安装的rpm,即执行如下命令:

rpm -ivh install_rpm/*.rpm

启动docker:

systemctl start docker

设置docker开机自启动:

systemctl enable docker

验证是否安装成功,直接输入如下命令:

docker version

如果出现下面页面,则表示安装成功了!

到此,关于“CentOS7离线部署docker”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注天达云网站,小编会继续努力为大家带来更多实用的文章!

返回云计算教程...