Code Monkey home page Code Monkey logo

docker-sync's Introduction

docker-sync

同步 Docker 镜像到指定镜像仓库

go run main.go

config.yml配置如下:

[]为可选

# 分别配置拉取和推送,便于在不同网络环境完成工作
pull: true
push: true

sync:
  - src: REPOSITORY[:TAG][@DIGEST]
    dst: REPOSITORY[:TAG]

同步后输出synced.yml结构:

sync:
  - src: REPOSITORY:TAG@DIGEST
    dst: REPOSITORY:TAG@DIGEST

执行过程

Pull Image

$ docker pull hello-world:latest@sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec

sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec: Pulling from library/hello-world
Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
Status: Image is up to date for hello-world@sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
docker.io/library/hello-world:latest@sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec

通过 REPOSITORY:TAG 查看 ImageId

$ docker images --format {{.ID}} hello-world:latest

bf756fb1ae65

为 ImageId 打 Tag,并 Push

$ docker tag bf756fb1ae65 registry.cn-hangzhou.aliyuncs.com/hb-chen/hello-world:v0.0.1
$ docker push registry.cn-hangzhou.aliyuncs.com/hb-chen/hello-world:v0.0.1

The push refers to repository [registry.cn-hangzhou.aliyuncs.com/hb-chen/hello-world]
9c27e219663c: Preparing
9c27e219663c: Layer already exists
v0.0.1: digest: sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042 size: 525

Push 后获取 Digest,输出同步后 Image 列表

docker-sync's People

Contributors

hb-chen avatar

Stargazers

 avatar

Watchers

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