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:
. ├── cmd/ # Main program entry ├── pkg/ │ ├── api/ # TCR image repository API │ └── images/ # Image acquisition module │ └── sync/ # Image transmission logic ├── config/ # Configuration parsing ├── logger/ # Logging module
git clone https://cnb.cool/cnb/plugins/cnbcool/tcr-migrate.git go build -o tcr-migrate ./cmd
docker pull docker.cnb.cool/cnb/plugins/cnbcool/tcr-migrate:latest
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
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)# View image list (display total and first 100)
tcr-migrate get-images
# Execute migration (default reads config.yaml)
tcr-migrate sync-images
docker run -v ./config.yaml:/app/config.yaml docker.cnb.cool/cnb/plugins/cnbcool/tcr-migrate:latest