I’ve been experimenting with using docker-compose to create an app with macvlan support (uses a modified balena-engine fork that reinstates macvlan support).
The problem is that once deployed to the device, the macvlan device is not working. I suspect that this is because the
parent: eth0 configuration is not being carried across from the docker-compose.yml file:
version: '2' services: macvlantest0: build: ./macvlan-test privileged: true networks: macvlan0: ipv4_address: 192.168.1.200 networks: macvlan0: driver: macvlan driver_opts: parent: eth0 ipam: config: - subnet: 192.168.1.0/24 ip_range: 192.168.1.0/24 gateway: 192.168.1.254
A macvlan device 1_macvlan0 is created on the target, but if I run
balena network inspect 1_macvlan0 then I can see that the options.parent field is blank:
If I manually create a network device on the target then it works:
balena network create -d macvlan --subnet=192.168.2.0/24 --gateway=192.168.2.254 -o parent=eth0 macvlan1
The parent device is configured successfully and I can get macvlan mode working on this device.
So it looks like there is some problem with translating the docker-compose.yml macvlan network configuration into the macvlan device on the target, but no fundamental problem with using macvlan because it can be added manually.
One thing I have noticed is a vague message about the
networks field in the docker-compose.yml file being limited on Balena: https://www.balena.io/docs/reference/supervisor/docker-compose/
networks: “Only support specifying network names”
Is docker-compose in Balena limited in functionality compared to standard Docker? Can we not use the
networks field in the same way?