Giter Site home page Giter Site logo

xdongliang / docker_image_pusher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tech-shrimp/docker_image_pusher

0.0 0.0 0.0 738 KB

使用Github Action将国外的Docker镜像转存到阿里云私有仓库,供国内服务器使用,免费易用

License: Apache License 2.0

docker_image_pusher's Introduction

Docker Images Pusher

使用Github Action将国外的Docker镜像转存到阿里云私有仓库,供国内服务器使用,免费易用

  • 支持DockerHub, gcr.io, k8s.io, ghcr.io等任意仓库
  • 支持最大40GB的大型镜像
  • 使用阿里云的官方线路,速度快

视频教程:https://www.bilibili.com/video/BV1Zn4y19743/

作者:技术爬爬虾
B站,抖音,Youtube全网同名,转载请注明作者

使用方式

配置阿里云

登录阿里云容器镜像服务
https://cr.console.aliyun.com/
启用个人实例,创建一个命名空间(ALIYUN_NAME_SPACE

访问凭证–>获取环境变量
用户名(ALIYUN_REGISTRY_USER)
密码(ALIYUN_REGISTRY_PASSWORD)
仓库地址(ALIYUN_REGISTRY

Fork本项目

Fork本项目

启动Action

进入您自己的项目,点击Action,启用Github Action功能

配置环境变量

进入Settings->Secret and variables->Actions->New Repository secret 将上一步的四个值
ALIYUN_NAME_SPACE,ALIYUN_REGISTRY_USER,ALIYUN_REGISTRY_PASSWORD,ALIYUN_REGISTRY
配置成环境变量

添加镜像

打开images.txt文件,添加你想要的镜像 可以加tag,也可以不用(默认latest)
可添加 --platform=xxxxx 的参数指定镜像架构
可使用 k8s.gcr.io/kube-state-metrics/kube-state-metrics 格式指定私库
可使用 #开头作为注释
文件提交后,自动进入Github Action构建

使用镜像

回到阿里云,镜像仓库,点击任意镜像,可查看镜像状态。(可以改成公开,拉取镜像免登录)

在国内服务器pull镜像, 例如:

docker pull registry.cn-hangzhou.aliyuncs.com/shrimp-images/alpine

registry.cn-hangzhou.aliyuncs.com 即 ALIYUN_REGISTRY(阿里云仓库地址)
shrimp-images 即 ALIYUN_NAME_SPACE(阿里云命名空间)
alpine 即 阿里云中显示的镜像名

多架构

需要在images.txt中用 --platform=xxxxx手动指定镜像架构 指定后的架构会以前缀的形式放在镜像名字前面

镜像重名

程序自动判断是否存在名称相同, 但是属于不同命名空间的情况。 如果存在,会把命名空间作为前缀加在镜像名称前。 例如:

xhofe/alist
xiaoyaliu/alist

定时执行

修改/.github/workflows/docker.yaml文件 添加 schedule即可定时执行(此处cron使用UTC时区)

docker_image_pusher's People

Contributors

tech-shrimp avatar xdongliang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.