Last active
May 11, 2021 14:44
-
-
Save brandond/f207af653093690313e615e62e698e5b to your computer and use it in GitHub Desktop.
Ignorant hack of a script to mirror multiarch images on Docker Hub. Requires docker and jq.
This file contains 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
#!/bin/bash | |
FLAGS="" | |
SOURCE="docker.io/library" | |
DEST="docker.io/brandond" | |
IMAGE="busybox" | |
TAG="1.32.0-uclibc" | |
docker buildx imagetools inspect ${SOURCE}/${IMAGE}:${TAG} --raw | \ | |
jq -r '.manifests[] | (.digest + " " + .platform.architecture)' | \ | |
while read DIGEST ARCH; do | |
docker pull ${SOURCE}/${IMAGE}:${TAG}@${DIGEST} | |
docker tag ${SOURCE}/${IMAGE}:${TAG}@${DIGEST} ${DEST}/${IMAGE}:${TAG}-${ARCH} | |
docker push ${DEST}/${IMAGE}:${TAG}-${ARCH} | |
docker buildx imagetools create ${FLAGS} --tag ${DEST}/${IMAGE}:${TAG} ${DEST}/${IMAGE}:${TAG}-${ARCH}; | |
docker buildx imagetools create ${FLAGS} --tag ${DEST}/${IMAGE}:latest ${DEST}/${IMAGE}:${TAG}-${ARCH}; | |
FLAGS="--append" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment