Docker's default bridge networking works by hiding containers behind the host and mapping ports through to them. That's fine until you hit something that really wants its own address on the LAN — a service that advertises itself on the network, something doing multicast discovery, or just a case where port-mapping gets awkward. That's where the macvlan driver looks like the perfect answer: it gives each container a real MAC address and its own IP on your physical network, as if it were a separate physical machine plugged into the switch.
It genuinely is great for that. But it comes with a set of non-obvious behaviours that will bite you if you don't know about them in advance — and most of them aren't in the quick-start guides. This is the "read this first" version.
Gotcha #1: the host can't talk to its own containers
This is the big one, and it catches almost everyone. By design, a host cannot communicate with its own containers over a macvlan network. The container is on the LAN, other machines on the LAN can reach it perfectly — but the Docker host itself cannot, and vice versa.
This isn't a bug. It's a deliberate consequence of how macvlan works at the kernel level: traffic from the host's own interface to a macvlan sub-interface on that same interface gets filtered out rather than looping back. The result is deeply counterintuitive — every other device on your network can reach the container, but a service running directly on the host (a monitoring agent, a reverse proxy, a health check) cannot.
Why this hurts so much in practice: if you're running a reverse proxy on the Docker host itself and trying to proxy to containers on a macvlan network, it simply won't work — and the failure looks baffling, because those exact containers respond fine from your laptop. People lose hours to this before discovering it's expected behaviour, not a misconfiguration.
The workaround exists but adds complexity: you create a secondary macvlan sub-interface on the host itself, bridged into the same network, so the host has its own macvlan endpoint to talk to the containers through. It works, but it's fiddly, needs to survive reboots, and is exactly the kind of thing you'd want to know about before you architected around macvlan rather than after.
Gotcha #2: promiscuous mode and your switch
macvlan puts multiple MAC addresses on a single physical interface — one per container. Some environments don't take kindly to that:
- Virtualised hosts often need the underlying virtual NIC set to allow promiscuous mode / MAC address changes, or the hypervisor silently drops the container traffic because the MAC doesn't match what it expects on that port.
- Managed switches with port security may block or flag a single port suddenly presenting many MAC addresses, depending on how they're configured.
- Some Wi-Fi won't do it at all — macvlan generally wants a wired connection.
None of these are Docker's fault exactly, but they're all things that turn "it worked on my test box" into "it mysteriously doesn't work in production" without an obvious error message pointing at the cause.
Gotcha #3: IP address management is now your problem
Once containers have real IPs on your LAN, you have to think about them like real hosts:
- You must carve out a range that your DHCP server won't hand out, or you'll get address conflicts when DHCP leases an IP you've already assigned to a container. macvlan setups typically use static assignment from a reserved slice of the subnet, outside the DHCP pool.
- The gateway has to be correct for the real network, not a Docker-internal one — you're on the physical LAN now, so its actual gateway applies.
- Container IPs don't automatically get DNS names, so you're managing that mapping yourself if you want to reach containers by name.
Gotcha #4: it's easy to reach for when you didn't need to
This is less a technical trap and more a design one. macvlan is genuinely the right tool when a container needs to be a first-class citizen on the LAN — but a lot of the time, the thing people are actually trying to achieve (reach a container from elsewhere on the network) is better solved with a reverse proxy in front of bridge-networked containers. That keeps containers isolated, avoids every gotcha above, and gives you TLS termination and routing for free.
If your reason for macvlan is "I want to reach this container from another machine," pause and check whether a reverse proxy would do the job with far less friction. If your reason is "this service genuinely needs its own presence on the LAN — its own IP, its own MAC, participating in network discovery" — then macvlan is correct and worth the complexity.
Before you commit: a checklist
- Confirm you actually need LAN-level presence, rather than just reachability that a reverse proxy could provide more simply.
- Reserve an IP range outside your DHCP pool for container addresses, and document it so future-you doesn't hand those addresses out by accident.
- Plan for the host-to-container isolation up front — if anything on the host needs to reach these containers, you'll need the secondary macvlan interface workaround, so design for it now.
- Verify your switch and (if virtualised) hypervisor will tolerate multiple MACs on one port before building anything real on top.
- Make any host-side interface configuration reboot-persistent, since the manual workarounds don't survive a restart on their own.
The honest summary: macvlan is a genuinely useful driver that does something no other Docker networking mode does as cleanly. But it trades Docker's usual "it just works" isolation for real-network complexity, and the host-can't-reach-its-own-container behaviour in particular is the kind of thing that's obvious in hindsight and maddening in the moment. Know the gotchas going in and it's a fine tool. Discover them mid-deployment and it's a bad afternoon.
Frequently asked questions
Why can't my Docker host reach a container on a macvlan network?
This is expected behaviour, not a bug. macvlan deliberately isolates the host from its own containers on the same interface. The workaround is to create a secondary macvlan sub-interface on the host so it has its own endpoint on the network to reach the containers through.
Do I need a managed switch for Docker macvlan?
Not necessarily, but your switch and (on virtualised hosts) your hypervisor must tolerate multiple MAC addresses on a single port. Port security features or a hypervisor NIC that disallows MAC changes will silently drop container traffic.
When should I use macvlan instead of a reverse proxy?
Use macvlan when a container genuinely needs its own presence on the LAN — its own IP and MAC, participating in network discovery. If you only need to reach a container from elsewhere on the network, a reverse proxy in front of bridge-networked containers is usually simpler and avoids the macvlan gotchas.
How do I avoid IP conflicts with macvlan?
Assign container IPs from a range outside your DHCP server's pool, so DHCP never leases an address you've already given a container. Document the reserved range so it isn't reused later.
Wrestling with a container networking design? Get in touch — happy to talk through whether macvlan is the right call for your case.
Get in touch →