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

相关文章

线上Java OOM问题定位与解决方案超详细解析

《线上JavaOOM问题定位与解决方案超详细解析》OOM是JVM抛出的错误,表示内存分配失败,:本文主要介绍线上JavaOOM问题定位与解决方案的相关资料,文中通过代码介绍的非常详细,需要的朋... 目录一、OOM问题核心认知1.1 OOM定义与技术定位1.2 OOM常见类型及技术特征二、OOM问题定位工具

通过Docker容器部署Python环境的全流程

《通过Docker容器部署Python环境的全流程》在现代化开发流程中,Docker因其轻量化、环境隔离和跨平台一致性的特性,已成为部署Python应用的标准工具,本文将详细演示如何通过Docker容... 目录引言一、docker与python的协同优势二、核心步骤详解三、进阶配置技巧四、生产环境最佳实践

Python一次性将指定版本所有包上传PyPI镜像解决方案

《Python一次性将指定版本所有包上传PyPI镜像解决方案》本文主要介绍了一个安全、完整、可离线部署的解决方案,用于一次性准备指定Python版本的所有包,然后导出到内网环境,感兴趣的小伙伴可以跟随... 目录为什么需要这个方案完整解决方案1. 项目目录结构2. 创建智能下载脚本3. 创建包清单生成脚本4

java.sql.SQLTransientConnectionException连接超时异常原因及解决方案

《java.sql.SQLTransientConnectionException连接超时异常原因及解决方案》:本文主要介绍java.sql.SQLTransientConnectionExcep... 目录一、引言二、异常信息分析三、可能的原因3.1 连接池配置不合理3.2 数据库负载过高3.3 连接泄漏

Vue3绑定props默认值问题

《Vue3绑定props默认值问题》使用Vue3的defineProps配合TypeScript的interface定义props类型,并通过withDefaults设置默认值,使组件能安全访问传入的... 目录前言步骤步骤1:使用 defineProps 定义 Props步骤2:设置默认值总结前言使用T

使用docker搭建嵌入式Linux开发环境

《使用docker搭建嵌入式Linux开发环境》本文主要介绍了使用docker搭建嵌入式Linux开发环境,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录1、前言2、安装docker3、编写容器管理脚本4、创建容器1、前言在日常开发全志、rk等不同

RabbitMQ 延时队列插件安装与使用示例详解(基于 Delayed Message Plugin)

《RabbitMQ延时队列插件安装与使用示例详解(基于DelayedMessagePlugin)》本文详解RabbitMQ通过安装rabbitmq_delayed_message_exchan... 目录 一、什么是 RabbitMQ 延时队列? 二、安装前准备✅ RabbitMQ 环境要求 三、安装延时队

C#文件复制异常:"未能找到文件"的解决方案与预防措施

《C#文件复制异常:未能找到文件的解决方案与预防措施》在C#开发中,文件操作是基础中的基础,但有时最基础的File.Copy()方法也会抛出令人困惑的异常,当targetFilePath设置为D:2... 目录一个看似简单的文件操作问题问题重现与错误分析错误代码示例错误信息根本原因分析全面解决方案1. 确保

Web服务器-Nginx-高并发问题

《Web服务器-Nginx-高并发问题》Nginx通过事件驱动、I/O多路复用和异步非阻塞技术高效处理高并发,结合动静分离和限流策略,提升性能与稳定性... 目录前言一、架构1. 原生多进程架构2. 事件驱动模型3. IO多路复用4. 异步非阻塞 I/O5. Nginx高并发配置实战二、动静分离1. 职责2

解决升级JDK报错:module java.base does not“opens java.lang.reflect“to unnamed module问题

《解决升级JDK报错:modulejava.basedoesnot“opensjava.lang.reflect“tounnamedmodule问题》SpringBoot启动错误源于Jav... 目录问题描述原因分析解决方案总结问题描述启动sprintboot时报以下错误原因分析编程异js常是由Ja