Last active
March 21, 2024 15:33
-
-
Save omerfsen/bf809de1c1183cd280f2e2dc76270499 to your computer and use it in GitHub Desktop.
Docker Push multi-arch image
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
#!/bin/bash | |
# Docker buildx supports to build and push but | |
# Docker push does not support multi-arch so here is workaround to do | |
# via docker manifest | |
SOURCE_IMG=otheruser_that_has_both_arch/gpu-stress-test:1.0.0 | |
DEST_IMG=omerfsen/gpu-stress-test:1.0.0 | |
# Clean all images | |
docker image prune -a --force | |
# For arm64 | |
docker pull --platform linux/arm64 ${SOURCE_IMAGE} | |
docker tag ${SOURCE_IMAGE} ${DEST_IMAGE}-arm64 | |
docker push ${DEST_IMAGE}-arm64 | |
docker rmi ${SOURCE_IMAGE} | |
# For amd64 | |
docker pull --platform linux/amd64 ${SOURCE_IMAGE} | |
docker tag ${SOURCE_IMAGE} ${DEST_IMAGE}-amd64 | |
docker push ${DEST_IMAGE}-amd64 | |
docker rmi ${SOURCE_IMAGE} | |
# Push combined manifest | |
docker manifest create ${DEST_IMAGE} ${DEST_IMAGE}-arm64 ${DEST_IMAGE}-amd64 | |
docker manifest push ${DEST_IMAGE} | |
docker manifest inspect ${DEST_IMAGE} | |
# So now you can use | |
# docker pull --platform linux/arm64 ${DEST_IMAGE} | |
# docker pull --platform linux/arm64 ${DEST_IMAGE} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment