Macvlan and container to container communication

I couldn’t find a clear answer anywhere. Does containers on the same macvlan network can communicate with each other? Or do I need to do anything to make this happen? According to https://docs.docker.com/network/bridge/ “In terms of Docker, a bridge network uses a software bridge which allows containers connected to the same bridge network to communicate, while providing isolation from containers which are not connected to that bridge network.” So, my query is, is this is the same case on containers on the same macvlan network? Or do they communicate through the router?

Yep.

Think of it as if the parant interface of the macvlan will act as if you plug another switch into the network and the macvlan child interfaces will be connected to that switch.

Of course this is not true for macvlan. The macvlan child interfaces can communicate with all other devices in the same subnet, except the parent interface. A workaround to fix this behavior exists: it will introduce a macvlan child interface to the host, which can be used to set a route for the macvlan subnet from the host. Though containers will need to talk to the hosts child interface’s ip, instead of the parent interfaces ip.

There are plenty of blog posts that describe what needs to be done.

2 Likes

Thank you, for the clarification. I know macvlan needs another virtual to communicate with the host. Thank you again for the answer. This solved the issue :grinning: