i want to pull from nexus all images and push them in harbor i try to do that
docker login -u -p https://harbor.domaine.com/
docker tag nexus.domaine.com/tag:number harbor.domaine.com/project_name/tag:number
but the problem is that i have a lot of images and if i do this operation i need to write 1 line for every images so i want something like a loop too pull and push all images from nexus any help ?!
You can try use bash script, for example
#!/bin/bash
docker login -u -p https://harbor.domaine.com/
for image_name in $(docker images --format="{{.Repository}}:{{.Tag}}" | grep nexus.domaine.com)
do
new_image_name=$(echo $image_name | sed 's/nexus.domaine.com/harbor.domaine.com\/project_name/')
docker tag $image_name $new_image_name
docker push $new_image_name
done