centos7 安装docker

2023-05-16

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
出现以下内容则表示docker仓库配置成功:
Loaded plugins: fastestmirror
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

安装docker:

sudo yum install docker-ce
出现以下异常:
Loaded plugins: fastestmirror
base
https://download-stage.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#35 - "TCP connection reset by peer"
Trying other mirror.


 One of the configured repositories failed (Docker CE Stable - x86_64),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=docker-ce-stable ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable docker-ce-stable
        or
            subscription-manager repos --disable=docker-ce-stable

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=docker-ce-stable.skip_if_unavailable=true

failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
https://download-stage.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#35 - "TCP connection reset by peer"

分析原因为:阿里的镜像库文件也指向docker官方库,所以需要修改库文件:

sudo vim /etc/yum.repos.d/docker-ce.repo
通过命令把https://download-stage.docker.com替换为http://mirrors.aliyun.com/docker-ce
命令如下:
:%s#https://download-stage.docker.com#http://mirrors.aliyun.com/docker-ce#g

在执行安装docker的部分妈可安装成功。

sudo yum install docker-ce
内容如下:
Installed:
  docker-ce.x86_64 0:18.03.0.ce-1.el7.centos

Dependency Installed:
  audit-libs-python.x86_64 0:2.7.6-3.el7 checkpolicy.x86_64 0:2.5-4.el7   container-selinux.noarch 2:2.42-1.gitad8f0f7.el7 libcgroup.x86_64 0
  libtool-ltdl.x86_64 0:2.4.2-22.el7_3   pigz.x86_64 0:2.3.3-1.el7.centos policycoreutils-python.x86_64 0:2.5-17.1.el7     python-IPy.noarch

Complete!

验证docker安装成功:

启动docker:
sudo systemctl start docker
验证docker:
sudo docker run hello-world
则会出现以下异常:
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9bb5a5d4561a: Pulling fs layer
docker: error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/registry-v2/docker/registry/v2/blobs/sha256/e3/e38bc07ac18e
See 'docker run --help'.

此错误也是网络问题:国内无法访问dockerhub
配置阿里云的docker镜像库:在阿里云开通容器镜像服务拿到加速地址在执行以下命令:

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://{自已的编码}.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

再次验证docker:

sudo docker run hello-world
出现以下内容则表示安装成功:
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9bb5a5d4561a: Pull complete
Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

centos7 安装docker 的相关文章

随机推荐

  • PISSTV 树莓派慢扫描电视

    连接硬件 硬件 xff1a 树莓派 有驱动的摄像头 调试时需要usb wifi 配置树莓派 配置树莓派时要开启树莓派摄像头的支持 因为需要安装软件 xff0c 将树莓派连接到外网 测试摄像头拍照 使用raspistill命令进行拍照 ras
  • PID控制参数整定(调节方法)原理+图示+MATLAB调试

    序 首先最重要的是了解每个参数调节了系统响应的那些属性 xff0c 通过观察响应从而调节参数改变属性 PID的作用概述 xff1a 1 P产生响应速度和力度 xff0c 过小响应慢 xff0c 过大会产生振荡 xff0c 是I和D的基础 2
  • 关于VSCODE的插件 一

    官方API文档 1 要学好TypeScript 官方教程 1 1TypeScript是一门弱类型语言 强类型和弱类型主要是站在变量类型处理的角度进行分类的 这些概念未经过严格定义 xff0c 它们并不是属于语言本身固有的属性 xff0c 而
  • Pixhawk学习1——CMakeList.txt的解析

    在PX4的工程文件中 xff0c src modules下是具体的飞控代码 里面主要包含了传感器采集 姿态结算 姿态控制 xff0c 位置结算 位置控制等程序模块 在进行二次开发时 xff0c 需要添加的模块也是在这个文件夹里 每个文件夹里
  • Pixhawk学习2——uORB微对象请求代理及规则

    在Pixhawk中 xff0c 所有的功能被独立以进程模块为单位进行实现并工作 而每个进程模块都有一个 xff08 或多个 xff1f xff09 主题信息topic xff08 topic可以在Firmware msg里查看到所有的可使用
  • Pixhawk学习4——Commander相关分析

    Commander文件夹中的内容的作用主要为Pixhawk飞行模式的切换 该段程序会根据遥控器上的开关状态以及飞机飞行状态和各传感器性能状态进行判断 xff0c 最终实现飞行模式的切换 飞行模式切换主要涉及到以下几个文件 xff1a src
  • Pixhawk学习7——位置解算

    Pixhawk的位置解算分为两部分 xff0c 第一部分主要为传感器的数据获取 xff0c 而该部分最主要的就是GPS数据的提取 第二部分为与惯性器件之间的组合导航 组合导航的好处我就不用多说了 Pixhawk代码中目前主要有两处组合导航的
  • Pixhawk学习9——固定翼位置控制(L1控制+TECS总能量控制)

    本篇博客本来没有在之前的计划中 但由于最近项目上遇到了固定翼轨迹控制的一些问题 xff0c 所以就结合pix的程序学习总结了一下 不同于旋翼 xff0c 固定翼要实现位置变化必须得有一个轨迹变化过程 xff0c 因为它不像旋翼那样可以直接调
  • Pixhawk学习10.2——多旋翼位置控制

    10 1中介绍了目标位置点的计算逻辑 xff0c 知道下一时刻的目标位置后 xff0c 飞控需要根据当前位置进行计算 xff0c 依次得到期望速度 xff0c 期望拉力矢量 xff0c 期望姿态 至此就完成了多旋翼的位置控制 1 期望速度计
  • Http权威指南笔记(三)——HTTP报文

    前面介绍了URL是用于定位服务器上的资源 但是定位到资源后 xff0c 通过什么样的方式 规定来让客户端和服务端进行交流呢 xff1f 这就是本篇要介绍的HTTP报文 1 报文流 HTTP 报文是在 HTTP 应用程序之间发送的数据块 这些
  • 卡尔曼滤波算法详细推导

    一 预备知识 1 协方差矩阵 是一个维列向量 xff0c 是的期望 xff0c 协方差矩阵为 可以看出 协方差矩阵都是对称矩阵且是半正定的 协方差矩阵的迹是的均方误差 2 用到的两个矩阵微分公式 公式一 xff1a 公式二 xff1a 若是
  • 超声波测距实验

    超声波测距实验 超声波发射器向某一方向发射超声波 xff0c 在发射的同时开始计时 xff0c 超声波在空气中传播 xff0c 途中碰到障碍物就立即返回来 xff0c 超声波接收器收到反射波就立即停止计时 声波在空气中的传播速度为340m
  • Win7+Ubuntu双系统安装教程

    一 安装Win7 xff08 采用WinPE 43 gho xff09 1 设置笔记本电脑的BIOS xff0c 因为是安装win7 xff0c 最好采用Legacy模式 xff0c UEFI模式和win8 win10等以后的操作系统适配的
  • C语言——switch....case函数用法

    switch case函数用法 include lt stdio h gt int main int data char cdata printf 34 请输入一个数字 n 34 scanf 34 d 34 amp data switch
  • 计算机组成原理4(程序查询方式、程序中断方式、DMA方式及其I/O接口电路)

    文章目录 一 程序查询方式二 程序中断方式三 DMA方式 一 程序查询方式 1 程序查询方式的接口电路 2 符号说明 amp 与非门B工作触发器D完成触发器 3 程序查询工作过程 xff08 输入 xff09 xff08 1 xff09 当
  • FreeRTOS队列创建、发送和接收(备忘)

    目录 一 简介 1 1 开发环境 1 2 功能说明 二 动态创建队列 2 1 头文件声明 2 2 工程文件定义 2 3 创建队列 三 静态创建队列 3 1 头文件声明 3 2 工程文件定义 3 3 创建队列 四 写入消息 4 1 定义缓存变
  • 自动化面试题2

    一 画出 集电极开路 电压输出 互补输出 线性驱动输出 原理图 二 二进制 八进制 十进制以及十六进制之间的转化 三 PLC是什么 xff0c 并简述其优点和缺点 可编程控制器 xff08 Programmable Logic Contro
  • 【教程】win10 固态硬盘卡机卡死卡顿的真正原因!

    本人自从换了win10以后从来没卡过的电脑反正就是频繁的卡顿 xff0c 卡死 我试过以下方法 xff0c 有人说是微软拼音输入法的问题 xff0c 我直接更换了输入法 xff0c 这个效果是有 xff0c 卡机的频率降低了 xff0c 但
  • SizeChanged事件

    SizeChanged事件有的人不成功 xff0c 我也不知道什么原因不成功 xff0c 贴一下我成功的样子 xff01 xff01 xff01 Designer cs文件Form最下面放这个 this SizeChanged 43 61
  • centos7 安装docker

    sudo yum config manager add repo http mirrors aliyun com docker ce linux centos docker ce repo 出现以下内容则表示docker仓库配置成功 xff