logo
0
0
Login

TCR Image Migration Tool

📌 Project Overview

tcr-migrate is a cross-platform image migration tool designed for Tencent Cloud Container Registry (TCR), supporting batch synchronization of images to Docker Hub, private registries (such as Harbor), or other OCI-compliant image registries. Core features include:

  • Multi-architecture support: Compatible with Linux amd64/arm64, Windows, and other system architectures
  • Concurrency control: Configurable 1-10 level concurrent migration
  • Secure transmission: Support for TLS verification and configuration file encryption
  • Log tracking: Detailed logs at Debug level

📂 Project Structure

. ├── cmd/ # Main program entry ├── pkg/ │ ├── api/ # TCR image repository API │ └── images/ # Image acquisition module │ └── sync/ # Image transmission logic ├── config/ # Configuration parsing ├── logger/ # Logging module

🛠️ Quick Start

Environment Requirements:

  • Go 1.20+ environment (development environment)
  • Docker 20.10+ (containerized operation)
  • Network access permission to target repository

Installation Methods:

Local Compilation and Running

git clone https://cnb.cool/cnb/plugins/cnbcool/tcr-migrate.git go build -o tcr-migrate ./cmd

Containerized Operation (Recommended)

docker pull docker.cnb.cool/cnb/plugins/cnbcool/tcr-migrate:latest

🔧 Configuration Instructions

Configuration File Structure

Create a config.yaml file (example template can be generated through coding.yaml-example):

concurrency: 5 # Concurrency [1-10] log_level: info # Log level (debug/info/warn/error) source: domain: "ccr.ccs.tencentyun.com" # Personal version domain enterprise_domain: "tencentcloudcr.com" # Enterprise version domain registry: "your-registry" # Required for enterprise version, application name namespace: "dev-ns" # Optional, namespace repository: "" # Optional, repository name region: "ap-guangzhou" # Required secret_id: "$TENCENT_SECRET_ID" secret_key: "$TENCENT_SECRET_KEY" credentials: username: "$TCR_USERNAME" password: "<PASSWORD>" target: domain: docker.cnb.cool namespace: cnb # Optional namespace, image path namespace/repository repository: tcr-migrate # Optional repository name credentials: username: cnb password: <PASSWORD> tls_verify: true # Optional, default true

Configuration File Description

concurrency sets synchronization concurrency, minimum 1, maximum 10.

log_level log level, debug, info, warn, error

source sets source image repository information,

  • domain tcr repository personal version domain: ccr.ccs.tencentyun.com (no need to modify)
  • enterprise_domain tcr repository enterprise version domain: tencentcloudcr.com (no need to modify)
  • registry tcr application name (required for enterprise version)
  • namespace tcr namespace (optional, can migrate images under specified ns)
  • repository tcr repository name (optional, can migrate images under specified repository)
  • region tcr cloud region (required, e.g.: ap-guangzhou, Region List)
  • secret_id access key of the cloud account where tcr is located (required, needs tcr viewing permission)
  • secret_key access key of the cloud account where tcr is located (required)
  • credentials
    • username tcr repository username (required, e.g.: 100011945374)
    • password tcr repository password (required, e.g.: )

target sets target image repository information,

  • domain target image repository domain (required, e.g.: docker.cnb.cool)
  • namespace target image repository namespace (optional, part of image path)
  • repository target image repository name (optional, part of image path)
  • tls_verify whether to enable TLS verification for target image repository (optional, e.g.: true, false)
  • credentials
    • username target repository username (required)
    • password target repository password (required)

📝 Usage Guide

Basic Commands

# View image list (display total and first 100) tcr-migrate get-images # Execute migration (default reads config.yaml) tcr-migrate sync-images

Docker Running Example

docker run -v ./config.yaml:/app/config.yaml docker.cnb.cool/cnb/plugins/cnbcool/tcr-migrate:latest

Image Repository Permission Description

  • Source image repository: Requires viewing permission
  • Target image repository: Requires write permission

About

No description, topics, or website provided.
Language
Go93.8%
Markdown3.7%
License1.5%
Makefile0.3%
Others0.7%