-
Notifications
You must be signed in to change notification settings - Fork 275
Description
Tell us about your request
Docker compose should autodetect the architecture of the host machine, and if a linux/<architecture>
image of a service is available for that architecture, use that version instead of defaulting to amd64. This will make many services more efficient and use less resources when running on non-amd64 architectures (i.e. Apple Silicon).
Which service(s) is this request for?
Docker Compose
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
Images that use my host architecture (arm64) run faster and more efficiently than when this needs to be emulated (amd64). Most well-known images have arm64 versions available, but docker-compose always seems to default to amd64. A different architecture should never matter, and does not matter for 99.9% of the services run in docker compose (e.g. Database, Redis), as the application should behave exactly the same regardless of architecture (note that platform (Windows/Linux/Mac) obviously does matter, which is why it should continue to use linux as default).
I'm trying to make one docker-compose.yml to put in my repository which will give the most efficient setup for all developers working on my project (who have varying architectures). I cannot currently do this (to my knowledge), I can only explicitly give a platform
per service, but this is then specific to one group of developers. Therefore, I would like docker-compose to have one of the following:
- a config option to enable autodetecting architecture for a service
- a config option to pick the best option out of a list of specified platforms
- for autodetecting architecture to be default behavior when platform is not explicitly specified for the service
Note that I do not mean to switch between Windows/Mac/Linux, but rather that it continues to default to Linux, but switches to the appropriate architecture (linux/arm64
or linux/amd64
are currently the most common) where possible.
Are you currently working around the issue?
You can make different compose templates for different users, and they manually pick the correct one for their system. This does mean the way to run docker compose gets more complex as they have to supply the correct compose file.
For example, if you add platform: linux/arm64
to every service, it will pick the arm64 version (there are some issues with images with the same tag but for different architectures, but that is a more general docker issue for which experimental solutions may already exist). This means you either have to supply multiple files, which complicates the setup, or instructions on what to add to the file depending on architecture. If the user has to change the docker-compose.yml
file as tracked in git, they have to also add a custom ignore for these changes, or make sure they do not commit them.
Additional context