Skip to content

Instantly share code, notes, and snippets.

@eloylp
Created September 27, 2018 09:39
Show Gist options
  • Save eloylp/de598ab0315c3dceb3259333cf146e04 to your computer and use it in GitHub Desktop.
Save eloylp/de598ab0315c3dceb3259333cf146e04 to your computer and use it in GitHub Desktop.
A simple script for moving your entire registry to other.
#!/bin/bash
# You must be logged in both registries before.
SOURCE_REGISTRY_IMAGES=(
your.source.registry/namespace1/subnamespace1/image1:tag
your.source.registry/namespace1/subnamespace1/image2:tag
)
DESTINATION_REGISTRY_NAMESPACE="your.destination.registry/namespace/subnamespace"
for i in ${SOURCE_REGISTRY_IMAGES[*]}; do
image=$(echo -n $i | rev | cut -d "/" -f1 | rev )
docker pull $i
docker tag $i $DESTINATION_REGISTRY_NAMESPACE/$image
docker push $DESTINATION_REGISTRY_NAMESPACE/$image
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment