解决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

相关内容

热门资讯

汪苏泷、薛之谦演唱会,出现“发... 演唱会装备党把这个设备拿出来,主办方感觉天都要塌了: 以后前排的票,可怎么卖? 以前年轻人去演唱会,...
拉普拉斯获得实用新型专利授权:... 证券之星消息,根据天眼查APP数据显示拉普拉斯(688726)新获得一项实用新型专利授权,专利名为“...
天舟十号满载科学与梦想 超6吨... 央视网消息:天舟十号货运飞船总长10.6米,由货物舱和推进舱组成,专门用于为空间站运送货物,发射重量...
武大切割OPPO校友:我们到底... OPPO这次的母亲节文案,确实是价值观出了问题。说“我妈有两个老公”,想玩饭圈梗来打破刻板印象,但这...
“我们完全可以相互成就、共同繁... 在华扎根50年,美国企业康明斯与中国伙伴携手成长、共享机遇——“我们完全可以相互成就、共同繁荣”(见...
乌克兰总统办公室前主任被控涉嫌... △乌克兰总统办公室前主任叶尔马克(资料图)当地时间11日,乌克兰国家反腐败局和特别反腐败检察院表示,...
你的蓝牙耳机正在 “偷听”?国... 在科技飞速发展的当下,无线耳机、智能手表、无线键盘等蓝牙设备凭借“一键连接”带来的便捷优势,已广泛应...
光洋股份:公司立足成为最懂制造... 证券日报网5月11日讯 ,光洋股份在接受调研者提问时表示,公司近年来加快布局机器人领域,立足成为最懂...
重庆拟投千亿培育沉浸式与虚拟现... 🤖 由 文心大模型 生成的文章摘要 重庆市发布“十五五”现代服务业发展规划,明确投入1 重庆市发...
内存缩水开倒车!谷歌Pixel... 5月11日消息,据相关媒体报道,受全球DRAM供应紧缺影响,谷歌即将推出的Pixel 11系列在内存...