docker镜像仓库迁移

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

安装syncer

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

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

shell 复制代码
git clone https://github.com/MR5356/syncer.git
cd syncer
make all

使用syncer进行镜像迁移

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

shell 复制代码
[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.
shell 复制代码
[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

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

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

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

shell 复制代码
[root@toodo ~] ./syncer image -c config.yaml
相关推荐
likfishdn8 分钟前
Linux的文件与目录管理
linux·运维·服务器
chian-ocean28 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=30 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
Dontla1 小时前
Docker run --add-host参数解析(在容器启动时向/etc/hosts文件中添加自定义的主机名与IP映射)(适用于临时调试或测试)
tcp/ip·docker·容器
西西小飞龙1 小时前
Docker和K8S中pod、services、container的介绍和关系
docker·容器·kubernetes
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
kngines1 小时前
【实战 ES】实战 Elasticsearch:快速上手与深度实践-1.3.1单节点安装(Docker与手动部署)
大数据·elasticsearch·docker
北京耐用通信1 小时前
航空装配自动化神器Ethercat转profient网关搭配机器人精准控制
运维·机器人·自动化
吃汤圆的抹香鲸2 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net
崔lc4 小时前
linux中安装部署Jenkins,成功构建springboot项目详细教程
运维·jenkins