Ignore unavailable devices in docker-compose

If I put the following on a device that has i2c bus 1 and 7 on the host (RockPi) it builds and runs successfully:

devices:
      - /dev/i2c-7:/dev/i2c-7
      - /dev/i2c-1:/dev/i2c-1

However if I deploy this to a raspberry pi which doesn’t have i2c-7 then it fails to start the containers.

Is there a way to solve this without multiple docker-compose files / multiple repos?

Thanks

(P.S. I know I can use privileged: true but want to avoid that)

Hey Aaron!

As of today, unfortunately there is no way to do this . This would ideally be achieved via docker compose overrides but balena does not support it. We have an internal ticket tracking this and will inform you of the outcome.

Thanks

Does Balena CLI support environment variables (Environment variables in Compose | Docker Documentation)?

Could replace some of those volume paths with an environment variable, then try launching by passing a different variable each time. Not ideal, but if it supports env vars could be a way to go.