国内Docker镜像下载慢?四种解决方案任你选
小维AI总结
HunYuan-Turbos-Latest
思考中···
方法1:配置阿里云镜像源
推荐指数 ⭐
- 编辑配置文件
1 | sudo vim /etc/docker/daemon.json |
- 添加镜像源配置
1 | { |
- 查询docker信息
1 | docker info |
- 重启docker服务
1 | sudo systemctl daemon-reload |
- 测试拉取镜像
1 | time docker pull node:latest |
方法2:使用第三方镜像源
推荐指数 ⭐
可以问下GPt,huawei有没有这块的镜像,它会去查
或者下面Render 750h每个月实例时间
- 编辑配置文件
1 | vim /etc/docker/daemon.json |
- 添加镜像源配置
1 | { |
- 测试拉取镜像
1 | docker pull hub-latest-ffbe.onrender.com/library/tomcat:8 |
方法3:阿里云容器镜像服务+GitHub Actions
推荐指数 ⭐⭐⭐
登录阿里云容器镜像服务
https://cr.console.aliyun.com/
- 启用个人实例,创建一个命名空间(lucky-warehouse)
- 查看访问凭证–>获取环境变量
| 配置项 | 值 |
|---|---|
| 用户名(ALIYUN_REGISTRY_USER) | aliyun3947408954 |
| 密码(ALIYUN_REGISTRY_PASSWORD) | 你的密码 |
| 仓库地址(ALIYUN_REGISTRY) | registry.cn-hangzhou.aliyuncs.com |
- 登录阿里云容器镜像服务
1 | sudo docker login --username=aliyun3947408954 registry.cn-hangzhou.aliyuncs.com |
配置GitHub仓库
GitHub上fork这个项目:https://github.com/tech-shrimp/docker_image_pusher
启用Github Action功能(就是pages那里开启)
进入 Settings -> Secret and variables -> Actions -> New Repository secret
将上一步的四个值配置成环境变量:
1 | ALIYUN_NAME_SPACE |
添加镜像
打开images.txt文件,添加镜像可以加tag,也可以不用(默认latest)
1 | nginx |
- 可添加 --platform=xxxxx 的参数指定镜像架构
- 可使用 k8s.gcr.io/kube-state-metrics/kube-state-metrics 格式指定私库
- 可使用 #开头作为注释
- 文件提交后,自动进入Github Action构建
拉取镜像
回到阿里云,镜像仓库,点击任意镜像,可查看镜像状态。(可以改成公开,拉取镜像免登录)
1 | docker pull registry.cn-hangzhou.aliyuncs.com/lucky-warehouse/node-exporter |
方法4:科学上网
推荐指数 ⭐⭐⭐⭐⭐
虚拟卡(TUN)模式打开,虚拟机的网络就能访问Docker官网,如果不行,就是服务器版本不支持,太老了
评论







