GithubHelp home page GithubHelp logo

google_containers's Introduction

关于

可以去阿里云镜像仓库市场看看registry.aliyuncs.com/google_containers实际上这个ns是用户创建的。

由于这个ns的所有者同步太慢了,我便写了这个工具来时刻同步

本仓库只同步k8s.gcr.io ==> registry.aliyuncs.com/k8sxio,目前gcr.io/google_containers已经不和k8s.gcr.io一致了,所以目前只同步k8s.gcr.io

目前已经同步完了,可以看github action的运行状态

查看镜像列表的话去阿里云镜像仓库市场

登录后在搜索框那输入k8sxio/搜索即可,也可以看单独的镜像例如k8sxio/kube-apiserver

特性

  • 不依赖 Docker 运行

  • 同步期间不占用本地磁盘空间(直接通过标准库转发镜像)

  • 可控的并发同步(优雅关闭/可调节并发数量)

  • 核心拷贝方法引用的containers/image,部分代码借鉴了mritd

  • 利用 boltdb 存储每个镜像 manifest 信息的 crc32 校验值,通过比对判断是否需要同步,而不是每次请求目标仓库

  • 把 boltdb 文件放 docker镜像里存在 dockerhub 上,多次运行 action 来同步

用法

编译的话记得带上tag,关闭CGO

go build -tags=containers_image_openpgp main.go

sync命令是同步的命令,sum是查看boltdb文件的信息

imgsync sync --help
            
    Sync docker images.
    
    Usage:
      imgsync sync [flags]
    
    Flags:
          --addition-ns stringArray    addition ns to sync (default [])
          --command-timeout duration   timeout for the command execution.
          --db string                  the boltdb file (default "bolt.db")
      -h, --help                       help for sync
          --img-timeout duration       sync single image timeout. (default 15m0s)
          --live-interval duration     live output for travis-ci.
          --login-retry uint8          login retry when timeout. (default 2)
      -p, --password string            The password to push.
          --process-limit int          sync process limit. (default 2)
          --push-ns string             the ns push to
          --push-to string             the repo push to (default "docker.io")
          --query-limit int            http query limit. (default 10)
          --retry int                  retry count while err. (default 4)
          --retry-interval duration    retry interval while err. (default 4s)
      -u, --user string                The username to push.
    
    Global Flags:
          --debug   debug mode

示例

那里设置好环境变量来控制运行的一些属性,也可以把镜像同步到自己的内网仓库上

  ${HOME}/sync/imgsync sync 
  --db ${HOME}/sync/bolt.db 
  --push-to registry.aliyuncs.com 
  --password ${PASS} 
  --push-ns=k8sxio 
  --user [email protected] 
  --command-timeout ${TMOUT} 
  --process-limit ${PROCESS:=2}
  --img-timeout ${IMG_TMOUT:=10m} 
  --live-interval ${LIVE:=9m20s}
  --login-retry ${LOGIN_RETRY:=2}
  --debug=${DEBUG:=false} 

google_containers's People

Contributors

zhangguanzhang 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.