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

相关文章

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

CentOS7安装配置mysql5.7 tar免安装版

一、CentOS7.4系统自带mariadb # 查看系统自带的Mariadb[root@localhost~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64# 卸载系统自带的Mariadb[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7

Centos7安装Mongodb4

1、下载源码包 curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.1.tgz 2、解压 放到 /usr/local/ 目录下 tar -zxvf mongodb-linux-x86_64-rhel70-4.2.1.tgzmv mongodb-linux-x86_64-rhel70-4.2.1/

如何用Docker运行Django项目

本章教程,介绍如何用Docker创建一个Django,并运行能够访问。 一、拉取镜像 这里我们使用python3.11版本的docker镜像 docker pull python:3.11 二、运行容器 这里我们将容器内部的8080端口,映射到宿主机的80端口上。 docker run -itd --name python311 -p

好题——hdu2522(小数问题:求1/n的第一个循环节)

好喜欢这题,第一次做小数问题,一开始真心没思路,然后参考了网上的一些资料。 知识点***********************************无限不循环小数即无理数,不能写作两整数之比*****************************(一开始没想到,小学没学好) 此题1/n肯定是一个有限循环小数,了解这些后就能做此题了。 按照除法的机制,用一个函数表示出来就可以了,代码如下

hdu1043(八数码问题,广搜 + hash(实现状态压缩) )

利用康拓展开将一个排列映射成一个自然数,然后就变成了普通的广搜题。 #include<iostream>#include<algorithm>#include<string>#include<stack>#include<queue>#include<map>#include<stdio.h>#include<stdlib.h>#include<ctype.h>#inclu

Centos7安装JDK1.8保姆版

工欲善其事,必先利其器。这句话同样适用于学习Java编程。在开始Java的学习旅程之前,我们必须首先配置好适合的开发环境。 通过事先准备好这些工具和配置,我们可以避免在学习过程中遇到因环境问题导致的代码异常或错误。一个稳定、高效的开发环境能够让我们更加专注于代码的学习和编写,提升学习效率,减少不必要的困扰和挫折感。因此,在学习Java之初,投入一些时间和精力来配置好开发环境是非常值得的。这将为我

购买磨轮平衡机时应该注意什么问题和技巧

在购买磨轮平衡机时,您应该注意以下几个关键点: 平衡精度 平衡精度是衡量平衡机性能的核心指标,直接影响到不平衡量的检测与校准的准确性,从而决定磨轮的振动和噪声水平。高精度的平衡机能显著减少振动和噪声,提高磨削加工的精度。 转速范围 宽广的转速范围意味着平衡机能够处理更多种类的磨轮,适应不同的工作条件和规格要求。 振动监测能力 振动监测能力是评估平衡机性能的重要因素。通过传感器实时监

poj 1511 Invitation Cards(spfa最短路)

题意是给你点与点之间的距离,求来回到点1的最短路中的边权和。 因为边很大,不能用原来的dijkstra什么的,所以用spfa来做。并且注意要用long long int 来存储。 稍微改了一下学长的模板。 stack stl 实现代码: #include<stdio.h>#include<stack>using namespace std;const int M

安装nodejs环境

本文介绍了如何通过nvm(NodeVersionManager)安装和管理Node.js及npm的不同版本,包括下载安装脚本、检查版本并安装特定版本的方法。 1、安装nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash 2、查看nvm版本 nvm --version 3、安装