Created
June 27, 2019 19:09
-
-
Save aleguerra05/5f872011d111d560af741db54235ff6c to your computer and use it in GitHub Desktop.
Esport and Import all docker images.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--EXPORT | |
docker save $(docker images -q) -o /path/to/save/mydockersimages.tar | |
-- | |
docker images | awk '{if ($1 ~ /^(openshift|centos)/) print $1 " " $2 " " $3 }' | tr -c "a-z A-Z0-9_.\n-" "%" | while read REPOSITORY TAG IMAGE_ID | |
do | |
echo "== Saving $REPOSITORY $TAG $IMAGE_ID ==" | |
docker save -o /path/to/save/$REPOSITORY-$TAG-$IMAGE_ID.tar $IMAGE_ID | |
done | |
--IMPORT | |
docker load -i /path/to/save/mydockersimages.tar | |
-- | |
while read REPOSITORY TAG IMAGE_ID | |
do | |
echo "== Tagging $REPOSITORY $TAG $IMAGE_ID ==" | |
docker tag "$IMAGE_ID" "$REPOSITORY:$TAG" | |
done < mydockersimages.list | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment