I have created 2 macvlan networks, called network-50 with IP 192.168.50.202 and network-0 with IP 192.168.0.202. When attaching the container to these networks I gave the higher priority to network-50.
I’m not sure I understand the question. Nginx listens on each available IP addresses. There is no “priority” for that. If MacVLAN IPs don’t work, that has probably nothing to do with priorities.
If priority didn’t solve that either, I don’t know. I never use MacVLAN as I never had a separate IP address for all of my processes running on my machine. Thre are some cases when MacVLAN could be needed, but I never needed the kind of apps that could require it. In case of the bridge network, I and multiple IP addresses available on the host, I would link this topic
But I’m not sure about MacVLAN. For outgoing traffic, normally on a host machine you would configure the routing table with NetPlan or manually with “ip route” commands. But I never needed to change it in containers. If “priority” controlls which network the container is connected to first, that would be my first thought
There isn’t a way to force default gateway selection at the moment. As you spotted, it’s just alphabetical order (plus some rules about dual-stack and internal networks).
But, the upcoming moby 28.0 release the CLI will get a gw-priority option, and Compose will have an equivalent.
We’re currently hoping to ship 28.0 on Wednesday next week, with a first release candidate maybe-today … those might slip, but it should be available fairly soon.
(With apologies for replying in the wrong language!)