CentOS7 docker.repo 用阿里云Docker Yum源

yum安装软件的时候经常出现找不到镜像的情况

https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 12] Timeout on 

解决方法:更新/etc/yum.repos.d目录下的docker.repo文件内容,使用阿里的镜像源

[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-edge]
name=Docker CE Edge - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-edge-debuginfo]
name=Docker CE Edge - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-edge-source]
name=Docker CE Edge - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/edge
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

 如果是CentOS-Base.repo,则改成

 1 # CentOS-Base.repo
 2 #
 3 # The mirror system uses the connecting IP address of the client and the
 4 # update status of each mirror to pick mirrors that are updated to and
 5 # geographically close to the client.  You should use this for CentOS updates
 6 # unless you are manually picking other mirrors.
 7 #
 8 # If the mirrorlist= does not work for you, as a fall back you can try the 
 9 # remarked out baseurl= line instead.
10 #
11 #
12  
13 [base]
14 name=CentOS-$releasever - Base - mirrors.aliyun.com
15 failovermethod=priority
16 baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
17         http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
18         http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
19 gpgcheck=1
20 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
21  
22 #released updates 
23 [updates]
24 name=CentOS-$releasever - Updates - mirrors.aliyun.com
25 failovermethod=priority
26 baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
27         http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
28         http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
29 gpgcheck=1
30 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
31  
32 #additional packages that may be useful
33 [extras]
34 name=CentOS-$releasever - Extras - mirrors.aliyun.com
35 failovermethod=priority
36 baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
37         http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
38         http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
39 gpgcheck=1
40 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
41  
42 #additional packages that extend functionality of existing packages
43 [centosplus]
44 name=CentOS-$releasever - Plus - mirrors.aliyun.com
45 failovermethod=priority
46 baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
47         http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
48         http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
49 gpgcheck=1
50 enabled=0
51 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
52  
53 #contrib - packages by Centos Users
54 [contrib]
55 name=CentOS-$releasever - Contrib - mirrors.aliyun.com
56 failovermethod=priority
57 baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
58         http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
59         http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
60 gpgcheck=1
61 enabled=0
62 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

或者

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

 

posted @ 2018-12-18 20:21  柠檬味的橘子皮  阅读(16965)  评论(0编辑  收藏  举报