Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I pull/push the Docker image for all os/arch into Dockerhub? [duplicate]

I'm trying to pull a Docker image from Dockerhub and copy it into my own Dockerhub registry. I want to do this for all os/architectures available under the tag I am copying. For example, node:latest has the following architectures:

linux/amd64
linux/arm/v7
linux/arm64/v8

If I run the following:

docker pull node:latest
docker tag node:latest myregistry/node:latest
docker push myregistry/node:latest

I only end up with linux/amd64 in my registry, because my laptop is Intel and only pulls/pushes the Intel architecture. I want to be able to pull/push the arm architectures as well, so M1 users can pull from my registry.

How can I do this? The images are already built, so I don't want to have to rebuild them, and I don't have an M1. I just want to "copy" the image that has already been built into my registry.

like image 326
blindsnowmobile Avatar asked Oct 24 '25 04:10

blindsnowmobile


1 Answers

This seems to have done the trick:

docker pull node:latest
docker manifest inspect # <- note the digests of the architectures you want to include

# Create a tag for any digests you are interested in
docker tag node:latest@sha256:867c09f220095929f3ab4113e7530a6e38833f2eb4317cb8998307528026621f myregistry/node:latest-amd64
docker tag node:latest@sha256:55298bd901ba7d9b914842c0cbb1087571b50121791846a17b78fa02f904962b myregistry/node:latest-arm64

# Push to your registry
docker push myregistry/node:latest-arm64
docker push myregistry/node:latest-amd64

# Create and push the manifest
docker manifest create myregistry/node:latest --amend myregistry/node:latest-arm64 --amend myregistry/node:latest-amd64
docker manifest push myregistry/node:latest

Dockerhub will list both architectures under the "latest" tag:

enter image description here

like image 162
blindsnowmobile Avatar answered Oct 26 '25 17:10

blindsnowmobile