解决Centos7安装docker源问题
admin
2023-04-08 12:23:29
0

根据官方文档:https://docs.docker.com/install/linux/docker-ce/centos/搭建docker 

1.卸载docker旧版本:

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine\

2.安装相关工具类:

sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2

3.配置docker仓库:

sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo

会报以下错误: Loaded plugins: fastestmirror adding repo from: https://download.docker.com/linux/centos/docker-ce.repo grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo Could not fetch/save url https://download.docker.com/linux/centos/docker-ce.repo to file /etc/yum.repos.d/docker-ce.repo : [Errno 14] curl#35 - "TCP connection reset by peer

这是由于国内访问不到docker官方镜像的缘故 
可以通过aliyun的源来完成:

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

4.安装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"

[root@localhost yum.repos.d]# systemctl restart docker 
[root@localhost yum.repos.d]# systemctl status docker

相关内容

热门资讯

【第一消息】“么么棋牌可以开挂... 您好:么么棋牌这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9784099】很多玩家在这款游戏...
【第一消息】“决战武穴麻将怎么... 您好:决战武穴麻将这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9784099】很多玩家在这款...
重磅消息“夜猫麻将到底有挂吗?... 家人们!今天小编来为大家解答夜猫麻将透视挂怎么安装这个问题咨询软件客服徽9752949的挂在哪里买很...
玩家攻略科普“瓦力游戏怎么装挂... 网上科普关于“瓦力游戏有没有挂”话题很是火热,小编也是针对瓦力游戏作*弊开挂的方法以及开挂对应的知识...
终于了解“风风棋牌开挂神器?”... 网上科普关于“风风棋牌有没有挂”话题很是火热,小编也是针对风风棋牌作*弊开挂的方法以及开挂对应的知识...
【第一资讯】“微信小程序掼蛋开... 【第一资讯】“微信小程序掼蛋开挂器?”(详细开挂教程)您好,微信小程序掼蛋这个游戏其实有挂的,确实是...
今日重磅消息“全民游戏辅助器?... 有 亲,根据资深记者爆料全民游戏是可以开挂的,确实有挂(咨询软件无需打开...
重磅消息“德扑之星有挂吗?”(... 重磅消息“德扑之星有挂吗?”(太坑了果然有挂)您好,德扑之星这个游戏其实有挂的,确实是有挂的,需要了...
今日重大发现“牛魔王炸/金/花... 网上科普关于“牛魔王炸/金/花有没有挂”话题很是火热,小编也是针对牛魔王炸/金/花作*弊开挂的方法以...
终于了解“开心跑胡子是不是有挂... 有 亲,根据资深记者爆料开心跑胡子是可以开挂的,确实有挂(咨询软件无需打...