各种镜像加速配置
docker 镜像加速
Linux下,/etc/docker/daemon.json
,如果没有则创建.
{
"registry-mirrors":[
"http://f1361db2.m.daocloud.io",
"https://dockerhub.azk8s.cn",
"https://hub-mirror.c.163.com"
]
}
然后重新加载配置,并重启docker.
systemctl daemon-reload
systemctl restart docker
注意: 配置文件的json格式要严格,最后的一项的逗号一定不要加,否则docker会启动失败.
上面的地址可能失效,还可以使用阿里云镜像加速(个人推荐):
1.在阿里云平台上搜索 容器镜像服务
.
2.开通此服务
3.获取加速器地址
4.将此地址加入到daemon.json中.
gradle 镜像加速
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
// 以下四行代码为阿里gradle 源
maven{ url 'https://maven.aliyun.com/repository/google'}
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
maven{ url 'https://maven.aliyun.com/repository/public'}
maven{ url 'https://maven.aliyun.com/repository/jcenter'}
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
// 所有的model 都优先使用阿里源
maven{ url 'https://maven.aliyun.com/repository/google'}
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
maven{ url 'https://maven.aliyun.com/repository/public'}
maven{ url 'https://maven.aliyun.com/repository/jcenter'}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
maven镜像加速
修改maven安装路径下,/conf/setting.xml
,在<mirrors></mirrors>
标签添加阿里云镜像.
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
nodejs 镜像加速
npm config set registry https://registry.npm.taobao.org
配置完后,可以通过以下命令查看是否配置成功.
npm config ls