V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
joudev
V2EX  ›  分享创造

利用 GitHub Actions 来实现 Docker 下载国外站点镜像

  •  
  •   joudev · 2022-01-24 16:47:21 +08:00 · 2298 次点击
    这是一个创建于 814 天前的主题,其中的信息可能已经有所发展或是发生改变。

    原理:让 GitHub Actions 去下载 gcr.iok8s.gcr.ioquay.ioghcr.io 等站点的镜像,重新打 tag 上传到 Docker Hub ;因为 Docker Hub 国内有很多的镜像加速器,下载很快。流程走完后 GitHub Actions 直接生成脚本给用户一键下载镜像。

    地址: https://github.com/togettoyou/hub-mirror

    下面是几种使用方式:

    1. 白嫖,直接在我的项目提交 issues

    要求:严格按照模板规范提交,可以参考 成功案例失败案例

    限制:每次提交最多 11 个镜像地址

    我的个人 Docker 账号有每日镜像拉取限额,请勿滥用

    2. 自己动手,Fork 本项目,绑定你自己的 Docker 账号

    需要设置 DOCKERHUB_USERNAMEDOCKERHUB_TOKEN 两个 Secrets

    3. 已有魔法,本地使用

    go install github.com/togettoyou/hub-mirror@latest
    
    hub-mirror --username=xxxxxx --password=xxxxxx --content='{ "hub-mirror": ["gcr.io/google-samples/microservices-demo/emailservice:v0.3.5"] }'
    
    5 条回复    2022-01-26 09:45:51 +08:00
    stille
        1
    stille  
       2022-01-24 20:45:11 +08:00   ❤️ 1
    前些时也写了个脚本来解决这个问题,大致逻辑也差不多..
    yxnwh
        2
    yxnwh  
       2022-01-25 08:13:18 +08:00   ❤️ 1
    强力马克
    ysicing
        3
    ysicing  
       2022-01-25 16:15:11 +08:00
    歪楼,我也写了 ergo ext sync
    twfb
        4
    twfb  
       2022-01-26 09:31:15 +08:00
    我都用 action 整 rss 服务, 还能爬被墙的内容, 有些国内的就只能挂代理了
    joudev
        5
    joudev  
    OP
       2022-01-26 09:45:51 +08:00
    @twfb 的确 action 可以搞好多骚操作
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5952 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 02:29 · PVG 10:29 · LAX 19:29 · JFK 22:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.