14

Docker images can be built for multi architectures. This is usually done by creating a specific image per architecture, and then creating manifest as a proxy to the right image depending on the system that pulls the image.

That's great.

Now, with docker-compose, it's also possible to build images, but I don't see a way to build the image depending on the architecture, so it seems like the only way to have a single docker-compose definition for multiple architectures, is to have pushed multi-arch images to a registry and pull from there.

Does anyone know of a way to build local images for the right arch with the docker-compose build step?

MrE
  • 19,584
  • 12
  • 87
  • 105

1 Answers1

12

I don't think you can use docker-compose build, but you could use docker buildx bake to build multi-arch using a docker-compose.yml.

docker buildx bake --push --set *.platform=linux/amd64,linux/arm64

You'll probably want to read more about docker buildx bake and building multi-platform images.

Ian Gregory
  • 5,770
  • 1
  • 29
  • 42
3ch01c
  • 2,336
  • 2
  • 17
  • 15