开发和运维常用镜像源

先推荐三个好用的镜像站点,这三个站点有很多常用工具的源

清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/

上海交通大学软件源镜像站:https://mirrors.sjtug.sjtu.edu.cn/

南京大学镜像站(非常全面)https://mirrors.nju.edu.cn/

阿里云镜像站:https://developer.aliyun.com/mirror/

npm

npm 使用三方镜像更合适的方法是使用 nrm。这个工具内置了几个常用的国内源。支持添加新的源,并且可以用命令行随意切换。

名称地址
腾讯https://mirrors.cloud.tencent.com/npm/
淘宝https://registry.npmmirror.com/
cnpmhttps://r.cnpmjs.org/
npm config set registry <registry-url>

npm --registry <registry-url> install [package-name]

还可以通过修改 .npmrc 文件实现,这个文件常见位置有:

<project-dir>/.npmrc

<home>/.npmrc

/etc/npmrc

# 修改/添加以下键值对
registry=<registry-url>

docker

方法一:配置 daemon.json

参考这篇文章 https://gist.github.com/y0ngb1n/7e8f16af3242c7815e7ca2f0833d3ea6

如果不能访问,可以参考下表

镜像加速器地址加速类型
DaoCloud 镜像站https://docker.m.daocloud.ioDocker Hub、GCR、K8S、GHCR、Quay、NVCR 等
Azure 中国镜像https://dockerhub.azk8s.cnDocker Hub、GCR、Quay
科大镜像站https://docker.mirrors.ustc.edu.cnDocker Hub、GCR、Quay
腾讯云https://mirror.ccs.tencentyun.comDocker Hub
Docker 镜像代理https://dockerproxy.comDocker Hub、GCR、K8S、GHCR
百度云https://mirror.baidubce.comDocker Hub
南京大学镜像站https://docker.nju.edu.cnDocker Hub、GCR、GHCR、Quay、NVCR 等
上海交大镜像站https://docker.mirrors.sjtug.sjtu.edu.cnDocker Hub、GCR 等
中科院软件所镜像站https://mirror.iscas.ac.cnDocker Hub
阿里云https://registry.cn-hangzhou.aliyuncs.comDocker Hub

修改 /etc/docker/daemon.json

{
  "registry-mirrors": ["https://registry.cn-hangzhou.aliyuncs.com"]
}
# 让配置生效
sudo systemctl daemon-reload
sudo systemctl restart docker

还有一种方法不用修改 daemon.json,那就是拼接前缀。以 nginx:latest 和 ghcr.io/valhalla/valhalla:latest 为例。

docker pull nginx:latest
docker pull docker.nju.edu.cn/nginx:latest

docker pull ghcr.io/valhalla/valhalla:latest
docker pull ghcr.nju.edu.cn/valhalla/valhalla:latest

方法二:直接通过代理网站下载

https://dockerproxy.com/ 是一个代理网站,可以下载 docker 镜像、k8s 镜像、Github 镜像、quary 镜像、微软镜像等。

具体使用方法,可以登录这个网站查看

conda

Windows 用户无法直接创建名为 .condarc 的文件,可先执行 conda config --set show_channel_urls yes 生成该文件之后再修改。

参考文章开头的镜像站

python/pip

参考文章开头的镜像站,搜索 pypi

# 临时
pip install <package-name> -i <mirror-url> --trusted-host <mirror-host>

# 全局
pip config set global.index-url <mirror-url> 
pip config set global.trusted-host <mirror-url>

ubuntu/centos

参考文章开头的镜像站

  • 10
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值