Centos 7.2.1511 安装 Docker 遇到的问题与解决方案

2024-03-10 18:18

本文主要是介绍Centos 7.2.1511 安装 Docker 遇到的问题与解决方案,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、前言

最近在一个集群上安装 Docker,本来多么简单的事却因为网络原因以及系统版本变得曲折了,也由于找到了不适合的解决方案,饶了一个弯,所以特此记录一下安装过程,防止重复踩坑。

==系统版本:Centos 7.2.1511==

二、下载与上传

由于服务器不能连接外网,所以服务器使用的是公司自带的 yum 仓库,但是仓库内没有 Docker 安装包,所以需要自己下载。

下载地址:https://yum.dockerproject.org/repo/main/centos/7/Packages/

下载文件:

  • docker-engine-1.13.1-1.el7.centos.x86_64.rpm
  • docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm

下载完成后,上传到服务器等待安装

三、安装

依次输入如下命令:

$ sudo yum -y localinstall docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm
$ sudo yum -y localinstall docker-engine-1.13.1-1.el7.centos.x86_64.rpm

这里使用yum -y localinstall命令,而不是rpm -ivh,是因为它会自动从仓库中下载并安装相应的依赖包,那么如果指定的仓库中有系统对应的版本,安装就应该是没问题的,但是我所使用的仓库中没有7.2.1511版本的安装包,在该目录下有一个readme文件(通过浏览器打开),内容如下:

This directory (and version of CentOS) is deprecated.  For normal users,
you should use /7/ and not /7.2.1511/ in your path. Please see this FAQ
concerning the CentOS release scheme:https://wiki.centos.org/FAQ/GeneralIf you know what you are doing, and absolutely want to remain at the 7.2.1511
level, go to http://vault.centos.org/ for packages. Please keep in mind that 7.2.1511 no longer gets any updates, nor
any security fix's.

嗯,大概意思就是让我使用版本7目录下的…

==由于对应版本的安装包不存在时发生的异常见附录1==

四、修改 yum 获取的版本

使用如下命令进入修改界面:

sudo vi /etc/yum.repos.d/CentOS-Base.repo

原文件如下:

[base]
name=CentOS-$releasever - Basebaseurl=http://s7repo01/centos/7.2.1511/os/$basearch/
gpgcheck=1
gpgkey=http://s7repo01/centos/RPM-GPG-KEY-CentOS-7#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://s7repo01/centos/7.2.1511/updates/$basearch/
gpgcheck=1
gpgkey=http://s7repo01/centos/RPM-GPG-KEY-CentOS-7#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://s7repo01/centos/7.2.1511/extras/$basearch/
gpgcheck=1
gpgkey=http://s7repo01/centos/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://s7repo01/centos/7.2.1511/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://s7repo01/centos/RPM-GPG-KEY-CentOS-7

将所有的baseurl属性修改为版本7对应的目录路径,baseurl属性修改后如下:

baseurl=http://s7repo01/centos/7/centosplus/$basearch/

注:只修改版本号即可,对应的仓库地址可能与此不同,能访问则不必修改。

五、继续安装

继续使用如下命令安装:

$ sudo yum -y localinstall docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm
$ sudo yum -y localinstall docker-engine-1.13.1-1.el7.centos.x86_64.rpm

如果出现某个仓库不能连接的情况,可使用如下命令禁用掉,例(查看具体的错误信息可获知仓库名称,这里是dockerrepo):

sudo yum-config-manager --disable dockerrepo

重新输入命令,安装成功

附录1:安装中的问题

Loaded plugins: fastestmirror
Repository cloudera-manager is listed more than once in the configuration
Examining docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm: docker-engine-selinux-1.13.1-1.el7.centos.noarch
Marking docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package docker-engine-selinux.noarch 0:1.13.1-1.el7.centos will be installed
--> Processing Dependency: selinux-policy-base >= 3.13.1-102 for package: docker-engine-selinux-1.13.1-1.el7.centos.noarch
http://s7repo01/centos/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article https://access.redhat.com/articles/1320623If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/http://s7repo01/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://s7repo01/centos/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
Loading mirror speeds from cached hostfile... 省略Error: Package: docker-engine-selinux-1.13.1-1.el7.centos.noarch (/docker-engine-selinux-1.13.1-1.el7.centos.noarch)Requires: selinux-policy-base >= 3.13.1-102Installed: selinux-policy-targeted-3.13.1-60.el7.noarch (@anaconda)selinux-policy-base = 3.13.1-60.el7Available: selinux-policy-minimum-3.13.1-60.el7.noarch (base)selinux-policy-base = 3.13.1-60.el7Available: selinux-policy-minimum-3.13.1-60.el7_2.3.noarch (updates)selinux-policy-base = 3.13.1-60.el7_2.3Available: selinux-policy-minimum-3.13.1-60.el7_2.7.noarch (updates)selinux-policy-base = 3.13.1-60.el7_2.7Available: selinux-policy-minimum-3.13.1-60.el7_2.9.noarch (updates)selinux-policy-base = 3.13.1-60.el7_2.9Available: selinux-policy-mls-3.13.1-60.el7.noarch (base)selinux-policy-base = 3.13.1-60.el7Available: selinux-policy-mls-3.13.1-60.el7_2.3.noarch (updates)selinux-policy-base = 3.13.1-60.el7_2.3Available: selinux-policy-mls-3.13.1-60.el7_2.7.noarch (updates)selinux-policy-base = 3.13.1-60.el7_2.7Available: selinux-policy-mls-3.13.1-60.el7_2.9.noarch (updates)selinux-policy-base = 3.13.1-60.el7_2.9Available: selinux-policy-targeted-3.13.1-60.el7_2.3.noarch (updates)selinux-policy-base = 3.13.1-60.el7_2.3Available: selinux-policy-targeted-3.13.1-60.el7_2.7.noarch (updates)selinux-policy-base = 3.13.1-60.el7_2.7Available: selinux-policy-targeted-3.13.1-60.el7_2.9.noarch (updates)selinux-policy-base = 3.13.1-60.el7_2.9
Error: Package: docker-engine-selinux-1.13.1-1.el7.centos.noarch (/docker-engine-selinux-1.13.1-1.el7.centos.noarch)Requires: selinux-policy-targeted >= 3.13.1-102Installed: selinux-policy-targeted-3.13.1-60.el7.noarch (@anaconda)selinux-policy-targeted = 3.13.1-60.el7Available: selinux-policy-targeted-3.13.1-60.el7_2.3.noarch (updates)selinux-policy-targeted = 3.13.1-60.el7_2.3Available: selinux-policy-targeted-3.13.1-60.el7_2.7.noarch (updates)selinux-policy-targeted = 3.13.1-60.el7_2.7Available: selinux-policy-targeted-3.13.1-60.el7_2.9.noarch (updates)selinux-policy-targeted = 3.13.1-60.el7_2.9You could try using --skip-broken to work around the problemYou could try running: rpm -Va --nofiles --nodigest

使用rpm命令安装,可看见需要的依赖包

sudo rpm -ivh docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm warning: docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
error: Failed dependencies:policycoreutils-python is needed by docker-engine-selinux-1.13.1-1.el7.centos.noarchselinux-policy-base >= 3.13.1-102 is needed by docker-engine-selinux-1.13.1-1.el7.centos.noarchselinux-policy-targeted >= 3.13.1-102 is needed by docker-engine-selinux-1.13.1-1.el7.centos.noarch

附录2:参考链接

http://www.cnblogs.com/mchina/archive/2013/01/04/2842275.html \
http://www.178linux.com/11404 \
http://www.jianshu.com/p/1fc580b71ea4 \
https://my.oschina.net/hanhanztj/blog/504915

这篇关于Centos 7.2.1511 安装 Docker 遇到的问题与解决方案的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/795095

相关文章

IDEA和GIT关于文件中LF和CRLF问题及解决

《IDEA和GIT关于文件中LF和CRLF问题及解决》文章总结:因IDEA默认使用CRLF换行符导致Shell脚本在Linux运行报错,需在编辑器和Git中统一为LF,通过调整Git的core.aut... 目录问题描述问题思考解决过程总结问题描述项目软件安装shell脚本上git仓库管理,但拉取后,上l

解决docker目录内存不足扩容处理方案

《解决docker目录内存不足扩容处理方案》文章介绍了Docker存储目录迁移方法:因系统盘空间不足,需将Docker数据迁移到更大磁盘(如/home/docker),通过修改daemon.json配... 目录1、查看服务器所有磁盘的使用情况2、查看docker镜像和容器存储目录的空间大小3、停止dock

idea npm install很慢问题及解决(nodejs)

《ideanpminstall很慢问题及解决(nodejs)》npm安装速度慢可通过配置国内镜像源(如淘宝)、清理缓存及切换工具解决,建议设置全局镜像(npmconfigsetregistryht... 目录idea npm install很慢(nodejs)配置国内镜像源清理缓存总结idea npm in

pycharm跑python项目易出错的问题总结

《pycharm跑python项目易出错的问题总结》:本文主要介绍pycharm跑python项目易出错问题的相关资料,当你在PyCharm中运行Python程序时遇到报错,可以按照以下步骤进行排... 1. 一定不要在pycharm终端里面创建环境安装别人的项目子模块等,有可能出现的问题就是你不报错都安装

idea突然报错Malformed \uxxxx encoding问题及解决

《idea突然报错Malformeduxxxxencoding问题及解决》Maven项目在切换Git分支时报错,提示project元素为描述符根元素,解决方法:删除Maven仓库中的resolv... 目www.chinasem.cn录问题解决方式总结问题idea 上的 maven China编程项目突然报错,是

Python爬虫HTTPS使用requests,httpx,aiohttp实战中的证书异步等问题

《Python爬虫HTTPS使用requests,httpx,aiohttp实战中的证书异步等问题》在爬虫工程里,“HTTPS”是绕不开的话题,HTTPS为传输加密提供保护,同时也给爬虫带来证书校验、... 目录一、核心问题与优先级检查(先问三件事)二、基础示例:requests 与证书处理三、高并发选型:

docker 重命名镜像的实现方法

《docker重命名镜像的实现方法》在Docker中无法直接重命名镜像,但可通过添加新标签、删除旧镜像后重新拉取/构建,或在DockerCompose中修改配置文件实现名称变更,感兴趣的可以了解一下... 目录使用标签(Tagging)删除旧的php镜像并重新拉取或构建使用docker Compose在Do

前端导出Excel文件出现乱码或文件损坏问题的解决办法

《前端导出Excel文件出现乱码或文件损坏问题的解决办法》在现代网页应用程序中,前端有时需要与后端进行数据交互,包括下载文件,:本文主要介绍前端导出Excel文件出现乱码或文件损坏问题的解决办法,... 目录1. 检查后端返回的数据格式2. 前端正确处理二进制数据方案 1:直接下载(推荐)方案 2:手动构造

python依赖管理工具UV的安装和使用教程

《python依赖管理工具UV的安装和使用教程》UV是一个用Rust编写的Python包安装和依赖管理工具,比传统工具(如pip)有着更快、更高效的体验,:本文主要介绍python依赖管理工具UV... 目录前言一、命令安装uv二、手动编译安装2.1在archlinux安装uv的依赖工具2.2从github

Python绘制TSP、VRP问题求解结果图全过程

《Python绘制TSP、VRP问题求解结果图全过程》本文介绍用Python绘制TSP和VRP问题的静态与动态结果图,静态图展示路径,动态图通过matplotlib.animation模块实现动画效果... 目录一、静态图二、动态图总结【代码】python绘制TSP、VRP问题求解结果图(包含静态图与动态图