Explained

Docker Networking for NAS Users: Bridge, Host, and Macvlan

Three network modes, three different relationships with your LAN — and a decade of forum confusion caused by one kernel restriction nobody quotes. Here are the modes as Docker documents them, translated into NAS decisions.

Published Nov 25, 2026

The short answer

Use a user-defined bridge for almost everything — it is Docker's default for a reason, and on a named bridge your containers find each other by service name through Docker's built-in DNS. Use host networking when a container must live on the LAN as itself and see broadcast traffic or every port — the DNS-filter case (AdGuard Home, Pi-hole) is the classic, and their own docs prescribe host mode. Use macvlan when a container needs its own first-class LAN identity with its own IP and MAC — and accept its famous restriction, in Docker's own words: containers on a macvlan network cannot communicate with the host directly. That one sentence explains most macvlan confusion ever posted.

Bridge: the default, done properly

A bridge network is a software switch on one host. Containers on the same bridge talk freely; each gets a private IP; outbound traffic is NATed so the LAN sees only the host's address; and inbound traffic is blocked until you publish a port (-p 8080:80 maps the host's 8080 to the container's 80). Two distinctions matter. First, the built-in default bridge is the lesser option — containers on it reach each other only by IP. A user-defined bridge (which Compose creates per project automatically) adds embedded DNS at 127.0.0.11, so services resolve each other by name, plus better isolation and on-the-fly attach/detach. Second, publishing is a security decision: Docker's docs call a published port available to the outside world by default, so bind to 127.0.0.1 when only the host itself needs the port. The bridge limitation to know: the container has no LAN identity of its own — clients see the host's IP and a port number, and the service cannot hear LAN broadcasts.

Host: no translation, no isolation

Host networking removes the container's network namespace entirely: the app binds the host's interfaces directly, with the host's IP, all its ports, and full sight of broadcast and multicast traffic. That is exactly what a network-wide DNS filter needs — it must own port 53 and hear the LAN as the LAN — which is why AdGuard Home and Pi-hole prescribe host mode in their Docker guidance, a fact worth stating because forum lore often claims they "require macvlan." They do not. The costs are the mirror of the benefits: no port remapping (a conflict is a conflict), no network isolation between the container and the host, and on Docker Desktop for Mac/Windows host networking behaves differently than on a Linux NAS — one more reason NAS users have the canonical experience here.

Macvlan: a real LAN citizen, with a wall

Macvlan gives a container its own MAC address and a real IP on your LAN, handed out from a range you carve from your subnet. To the router and every other device, the container is simply another machine — which is what you want for things like a secondary DNS server that must be reachable at a stable, distinct address, or a service your router must treat as a separate client. The restriction is kernel-level and documented verbatim: the host itself cannot talk to its own macvlan containers (and they cannot talk to it). The two documented workarounds are a macvlan shim interface on the host with a route to the container range, or simply reaching the container from any other device — which is why the classic symptom is "everyone can reach it except the NAS it runs on." Plan the shim before you need it, reserve the macvlan range in your router so DHCP never hands those addresses to anyone else, and do not reach for macvlan when host mode would do — it is the specialist tool of the three.

The decision table

NeedModeWhy
A normal app or Compose stackUser-defined bridgeName-based DNS between services; publish only the ports the LAN needs
Network-wide DNS filtering (AdGuard/Pi-hole)HostMust own port 53 and hear the LAN directly — the projects' own prescription
Discovery protocols and broadcast-heavy appsHost (usually)Broadcasts do not cross a bridge's NAT
Container needs its own LAN IP/MAC identityMacvlanA first-class LAN device — plus the host-isolation shim to plan
Two services want the same port on the hostBridge (remap) or macvlanHost mode cannot remap — the conflict is fatal there

Official documentation and references

Frequently asked questions

What is the difference between the default bridge and a user-defined bridge?

Name resolution and isolation. On a user-defined bridge, containers resolve each other by name via Docker's embedded DNS (127.0.0.11); on the default bridge they reach each other only by IP. Compose creates a user-defined bridge per project automatically — one more reason to prefer Compose.

Does Pi-hole or AdGuard Home need macvlan?

No — both projects prescribe host networking for their Docker installs. Macvlan enters the picture when you want the DNS server at its own distinct LAN address separate from the host, which is a preference, not a requirement.

Why can't my NAS reach its own macvlan container?

A kernel-level macvlan restriction, documented by Docker: the host and its macvlan containers cannot communicate directly. The standard workaround is a macvlan shim interface on the host with a route to the container's range; every other device on the LAN reaches the container normally.

When is host networking a bad idea?

When you need port remapping (host mode cannot remap — conflicts are fatal), when you want network isolation between the app and the host, and on Docker Desktop for Mac/Windows, where host networking behaves differently from Linux. On a Linux NAS it is the right tool for LAN-native services like DNS filters.

Related guides