• docker镜像仓库迁移


    Docker镜像迁移我们使用的工具是syncer,项目地址:https://github.com/MR5356/syncer , 并且这个工具支持多对多的镜像仓库迁移

    安装syncer

    通过下载对应系统的二进制文件进行安装:点击下载

    也可以通过源码进行安装,前提是有golang运行环境:

    git clone https://github.com/MR5356/syncer.git
    cd syncer
    make all
    
    • 1
    • 2
    • 3

    使用syncer进行镜像迁移

    安装成功后可以使用以下命令获取命令的help信息:

    [root@toodo ~] ./syncer -h
    
    Usage:
      syncer [command]
    
    Available Commands:
      completion  Generate the autocompletion script for the specified shell
      git         A git repo sync tool
      help        Help about any command
      image       A registry image sync tool
    
    Flags:
      -d, --debug     enable debug mode
      -h, --help      help for syncer
      -v, --version   version for syncer
    
    Use "syncer [command] --help" for more information about a command.
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    [root@toodo ~] ./syncer image -h
    
    A registry image sync tool implement by Go.
    
    Complete code is available at https://github.com/Mr5356/syncer
    
    Usage:
      syncer image [flags]
    
    Flags:
      -c, --config string   config file path
      -d, --debug           enable debug mode
      -h, --help            help for image
      -p, --proc int        process num (default 10)
      -r, --retries int     retries num (default 3)
      -v, --version         version for image
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    配置文件支持yaml格式和json格式,以yaml格式为例:

    # 仓库认证信息
    auth:
      registry.cn-hangzhou.aliyuncs.com:
        username: your_name
        password: your_password
        # http仓库可设置为true
        insecure: false
      docker.io:
        username: your_name
        password: your_password
        insecure: false
    # 镜像同步任务列表
    images:
      # 该镜像的所有标签将会进行同步
      registry.cn-hangzhou.aliyuncs.com/toodo/alpine: registry.cn-hangzhou.aliyuncs.com/toodo/test
      # 该镜像会同步到目标仓库,并使用新的tag
      alpine@sha256:1fd62556954250bac80d601a196bb7fd480ceba7c10e94dd8fd4c6d1c08783d5: registry.cn-hangzhou.aliyuncs.com/toodo/test:alpine-latest
      # 该镜像会同步至多个目标仓库,如果目标镜像没有填写tag,将会使用源镜像tag
      alpine:latest:
        - hub1.test.com/library/alpine
        - hub2.test.com/library/alpine
    # 最大并行数量
    proc: 3
    # 最大失败重试次数
    retries: 3
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25

    使用配置文件运行镜像迁移工具开始镜像迁移:

    [root@toodo ~] ./syncer image -c config.yaml
    
    • 1
  • 相关阅读:
    巨细靡遗流程控制,Go lang1.18入门精炼教程,由白丁入鸿儒,Go lang流程结构详解EP09
    bat & cmd 命令整理(待更新)
    Java关键字、转义字符与运算符优先级
    【附代码案例】深入理解 PyTorch 张量:叶子张量与非叶子张量
    51单片机+SIM800C(GSM模块)实现短信发送功能
    声音数据处理技术
    猿创征文 | [云原生]为微服务保驾护航之链路跟踪skywalking保姆级搭建教程
    【Mybatis】浅谈延迟加载
    MySQL隔离性实现原理
    Mybatis-Plus自动填充失效原因和解决方案
  • 原文地址:https://blog.csdn.net/m0_49475727/article/details/133889923