Open jinjianming opened 1 year ago
There is --scoped
, but that might also not do exactly what you need.
有
--scoped
,但这也可能无法完全满足您的需要。
I tried it and brought over the domain name of the source warehouse. I only want to bring the following path
[root@js-staging-env-177 ~]# skopeo sync --scoped --src docker --dest docker --src-tls-verify=false --dest-tls-verify=false registry.js.design/bitnami/redis-exporter:1.24.0-debian-10-r9 js-registry:5000/
INFO[0000] Tag presence check imagename="registry.js.design/bitnami/redis-exporter:1.24.0-debian-10-r9" tagged=true
INFO[0000] Copying image ref 1/1 from="docker://registry.js.design/bitnami/redis-exporter:1.24.0-debian-10-r9" to="docker://js-registry:5000/registry.js.design/bitnami/redis-exporter:1.24.0-debian-10-r9"
reality
js-registry:5000/registry.js.design/bitnami/redis-exporter:1.24.0-debian-10-r9
expect
js-registry:5000/bitnami/redis-exporter:1.24.0-debian-10-r9
Yes; I think the only way right now is to split up the YAML file and run skopeo sync
several times with different destinations.
是的; 我认为现在唯一的方法是拆分 YAML 文件并
skopeo sync
在不同的目的地运行多次。
I implemented it through the following script
function sync_docker(){
REGISTRY="js-registry:5000"
local yml_file=$2
# Get image names and tags from sync.yml and iterate through them
cat $yml_file | yq -o=json .[].images | jq -r 'to_entries[] | "\(.key):\(.value[0])"' | while read line; do
image=$(echo "$line" | cut -d',' -f2) # Extract image name and tag
project=$(echo "$line" | cut -d',' -f1 | cut -d'/' -f1 ) # Extract project name
dest_image="${REGISTRY}/${project}" # Construct destination image name
# Use skopeo sync to copy image from source to destination
skopeo --insecure-policy sync \
--src docker \
--dest docker \
--src-tls-verify=false \
--dest-tls-verify=false \
"registry.js.design/${image}" "${dest_image}"
done
}
A friendly reminder that this issue had no activity for 30 days.
A friendly reminder that this issue had no activity for 30 days.
For example mine : sync.yml
My Sync Command
My expected effect
Actual effect