常用系统/软件的镜像配置

/ Developer / 没有评论 / 300浏览

系统类(Dockerfile)

CentOS 7

...

RUN \
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo && \
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && \
curl -o /etc/yum.repos.d/CentOS-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo && \

...

CentOS 8

...

RUN \
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-8.repo && \
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo && \
curl -o /etc/yum.repos.d/CentOS-Base-163.repo http://mirrors.163.com/.help/CentOS8-Base-163.repo && \

...

Alpine

...

RUN \
echo https://mirrors.aliyun.com/alpine/v3.10/main/ > /etc/apk/repositories && \
echo https://mirrors.aliyun.com/alpine/v3.10/community/ >> /etc/apk/repositories && \
echo https://mirrors.aliyun.com/alpine/v3.10/releases/ >> /etc/apk/repositories && \

...

或者

...

RUN sed -i 's|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g' /etc/apk/repositories

...

Debian

...
...

echo deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib > /etc/apt/sources.list && \
echo deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib >> /etc/apt/sources.list && \
echo deb http://mirrors.aliyun.com/debian-security stretch/updates main >> /etc/apt/sources.list && \
echo deb-src http://mirrors.aliyun.com/debian-security stretch/updates main >> /etc/apt/sources.list && \
echo deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib >> /etc/apt/sources.list && \
echo deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib >> /etc/apt/sources.list && \
echo deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib >> /etc/apt/sources.list && \
echo deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib >> /etc/apt/sources.list && \

...

软件类

Maven

...

    <repositories>
        <repository>
            <id>aliyun</id>
            <name>aliyun's Maven</name>
            <url>http://maven.aliyun.com/repository/public/</url>
            <layout>default</layout>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>aliyun</id>
            <name>aliyun's Maven</name>
            <url>http://maven.aliyun.com/repository/public/</url>
        </pluginRepository>
    </pluginRepositories>

...

Gradle

...

    repositories {
        flatDir { dirs rootProject.projectDir.getAbsolutePath() + File.separator + 'aarlibs' }
        maven { url 'https://maven.aliyun.com/repository/central/' }
        maven { url 'https://maven.aliyun.com/repository/google/' }
        maven { url 'https://maven.aliyun.com/repository/jcenter/' }
        maven { url 'https://jitpack.io' }
        //google()
        //jcenter()
        //mavenLocal()
        //mavenCentral()
    }

...

Docker

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
    "registry-mirrors": [
        "https://n031lwjl.mirror.aliyuncs.com",
        "https://registry.docker-cn.com"
    ]
}
EOF