Hi,
We got two services that communicate with each other in the default network using the following docker-compose file:
version: '2'
services:
redis:
image: redis
ports:
- "6379:6379"
manager:
build: ./manager/
privileged: true
depends_on:
- redis
These services are both inside the xxx_default bridge network created by docker-compose, where xxx is the resin application id.
This setup works fine, until my manager
service needs access to the mac address of the host OS.
If we add network_mode: "host"
to the service it is unable to connect to other services since they are no longer in the same network: redis
is in the xxx_default network and manager
is in the host network.
Thus the manager
service should be in the host network while also being able to connect to the other services.
Here is what we tried to achieve this:
version: '2'
networks:
to_host:
driver: host
internal:
driver: bridge
services:
redis:
image: redis
networks:
- internal
ports:
- "6379:6379"
manager:
build: ./manager/
networks:
- to_host
- internal
privileged: true
depends_on:
- redis
This didn’t work since the networks created by balena were all bridge networks:
root@c258114:~# balena network ls
NETWORK ID NAME DRIVER SCOPE
2291902e710d xxx_default bridge local
7ec45f1e094a xxx_internal bridge local
199f4fa16bae xxx_to_host bridge local
022ca1b6853b bridge bridge local
168b6e906fac host host local
331763c499cd none null local
4cf7ede90136 supervisor0 bridge local
Then we tried to specify the host network created by balena as an external network, also to no avail:
version: '2'
networks:
to_host:
external:
name: host
services:
redis:
image: redis
ports:
- "6379:6379"
manager:
build: ./manager/
networks:
- to_host
privileged: true
depends_on:
- redis
What can we try to achieve this? Is this even possible?
Thanks in advance!