微服务架构 - CentOS7离线部署docker

时间:2023-12-22 21:13:26

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

关注我

以你最方便的方式关注我:

微信公众号:

微服务架构 - CentOS7离线部署docker