3

I'm trying create a Docker manifest in order to create a multi-platform image my-repo/my-image:<some-tag> on Dockerhub. Building for both platforms at once does not work since the Dockerfile expects a mounted tarball of compiled binaries. Also note that I'm using a AMD64 VM in a GitHub Actions CI, so I have to cross-compile to ARM64.

To build I use something like this:

# Build & push for ARM64; using registry cache since this takes forever to build
docker buildx build . \
    --tag my-repo/my-image-arm64:<some-tag> \
    --platform=linux/arm64 \
    --output type=registry \
    --build-arg tarball_uri=<link-to-arm64-tarball> \
    --cache-to type=registry,ref=my-repo/my-image-cache,mode=max \
    --cache-from type=registry,ref=my-repo/my-image-cache,mode=max

# Build & push for AMD64; a more conventional build
docker buildx build . \
    --tag my-repo/my-image-amd64:<some-tag> \
    --build-arg tarball_uri=<link-to-amd64-tarball>
docker push my-repo/my-image-amd64:<some-tag>

When I then however run the following command:

docker manifest create my-repo/image-name:<some-tag> \
    my-repo/my-image-amd64:<some-tag> \
    my-repo/my-image-arm64:<some-tag>

I get the error message

docker.io/my-repo/my-image-arm64:<some-tag> is a manifest list, only for the ARM64 image. Generally, a manifest list is created, but without the my-repo/my-image-arm64:<some-tag> manifest.

Assuming my-repo/my-image-arm64:<some-tag> is now actually a manifest list, I do

docker manifest inspect my-repo/my-image-arm64:<some-tag>

but then get

no such manifest: docker.io/my-repo/my-image-arm64:<some-tag>

Any ideas of what I'm doing wrong here?

Beolap
  • 768
  • 9
  • 15

1 Answers1

3

So an alternative solution to using docker manifest, is running the following, assuming that both my-repo/my-image-arm64:latest and my-repo/my-image-amd64:latest have been pushed to your registry:

docker buildx imagetools create -t my-repo/my-image:latest \
    my-repo/my-image-arm64:latest \
    my-repo/my-image-amd64:latest

This will also automatically push the new multi-platform image to your registry (e.g. Dockerhub).

Beolap
  • 768
  • 9
  • 15
  • 1
    Seems to be working. However, I cannot run docker manifest on the final image i.e `my-repo/my-image:latest` in your example. The docker pull command does pull architecture specific image, but the lack of manifest is a little concerning. Running `docker inspect ` shows the correct arch after pulling the image. – Dnj Abc Mar 17 '23 at 01:41
  • 1
    Yep, this solution completely disregards the usage of manifests. All I can say is that my multi-platform image works on both platforms. – Beolap Mar 17 '23 at 14:35
  • 1
    My guess is that recent releases of Docker Engine broke undocumented behavior for `manifest`. It's listed as experimental and subject to that sort of thing. – John Michelau Apr 21 '23 at 16:22