Host, none, macvlan and ipvlan networks

Advanced · 4 min

The network drivers that skip Docker's bridge: share the host's stack, have no network at all, or put containers straight on the LAN with their own addresses.

Before thisUser-defined networks and container DNS

Network Direction · 9 min · from 5:29

Host, none, macvlan and ipvlan networks

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by Network DirectionReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • --network host puts the container in the host's network namespace. It binds host ports directly, -p is ignored, and there is no NAT or isolation.
  • --network none gives the container only a loopback interface, for jobs that must not touch the network.
  • --network container:<name> shares another container's network namespace, so both see the same interfaces and localhost.
  • macvlan gives each container its own MAC and an address on the physical LAN. The host itself cannot talk to its macvlan containers without extra setup.
  • ipvlan gives containers LAN addresses that share the parent's MAC. L2 mode behaves like macvlan, and L3 mode routes and drops broadcast and multicast.
  • Docker creates no firewall rules for host, macvlan or ipvlan networks, so the host firewall and the LAN's own controls are all that protect them.

When the bridge is in the way

A bridge network puts every container behind the host’s address, with NAT for outbound traffic and published ports for inbound. That is right for web services. It is wrong for a few things: a monitoring agent that needs to see the host’s real interfaces, a VoIP server that needs thousands of UDP ports, a batch job that should have no network at all, or a legacy appliance that expects its own address on the office LAN. Docker has a driver for each.

host

docker run -d --network host nginx:1.29

The container skips getting its own network namespace and uses the host’s. nginx listens on the host’s port 80 directly. The host driver page lists the consequences:

  • No port mapping. -p and -P are ignored, with “WARNING: Published ports are discarded when using host network mode”.
  • No NAT and no docker-proxy per port, which helps performance and makes huge port ranges practical.
  • No network isolation. The container sees every host interface, can bind any port, and port clashes with host services are yours to avoid.

It is supported on Docker Engine on Linux, and on Docker Desktop from 4.34 as an opt-in setting, where “host” means the VM’s network made reachable from your machine.

none

docker run --rm --network none alpine:3.22 ip addr

Only a loopback interface exists, with 127.0.0.1 and, per the docs, no IPv6 loopback address. Use it for jobs that process untrusted input and should never talk to anything, such as a file converter or a sandboxed test.

Sharing another container’s network

--network container:<name> is not a driver, but it belongs here. The new container joins an existing container’s network namespace: same interfaces, same IP, same localhost. The networking overview’s example runs redis-cli -h 127.0.0.1 from a second container to reach a Redis server. It is the standard trick for debugging a minimal image: start a tools container on the app’s network and run ss, curl localhost or tcpdump there, the container-level version of nsenter -n from the namespaces lesson. Debugging a running container uses it.

macvlan

macvlan gives each container its own MAC address on a physical interface, so on the LAN it looks like another machine:

docker network create -d macvlan \
  --subnet 192.168.1.0/24 --gateway 192.168.1.1 \
  --ip-range 192.168.1.192/27 \
  -o parent=eth0 lan
docker run -d --network lan --ip 192.168.1.200 --name pihole pihole/pihole

The router and other devices reach 192.168.1.200 directly, on any port, with no publishing. --ip-range keeps Docker’s assignments out of the router’s DHCP pool. Use -o parent=eth0.50 to put containers on VLAN 50 through an 802.1Q sub-interface, which Docker creates if it is missing.

The macvlan page lists the catches:

  • The host cannot reach its own macvlan containers. This is a Linux kernel restriction on traffic between a macvlan child and its parent. The workaround is a macvlan interface on the host in the same subnet, or a second, bridge network on the container.
  • Your network must accept many MACs on one port. Switches with port security, and most cloud providers, block it. The NIC may need promiscuous mode.
  • Linux hosts only, not Docker Desktop and not rootless mode.

ipvlan

ipvlan also puts containers on the LAN, but all of them share the parent interface’s MAC address and are told apart by IP. That avoids the switch and cloud problems of many MACs.

docker network create -d ipvlan \
  --subnet 192.168.1.0/24 --gateway 192.168.1.1 \
  -o parent=eth0 -o ipvlan_mode=l2 lan-ipvlan

Its modes, from the ipvlan page:

  • l2 (the default). Containers are on the parent’s subnet, like macvlan without extra MACs.
  • l3. The host acts as a router for container subnets that the rest of the network does not know about. You must add routes on your router pointing those subnets at the Docker host. The docs note L3 mode drops all broadcast and multicast traffic, which makes it predictable at scale and breaks anything that relies on discovery protocols.
  • l3s. L3 with the host’s netfilter applied.

No Docker firewall rules

One line in the packet filtering page is worth remembering: Docker creates firewall rules for bridge networks, and “no rules are created for ipvlan, macvlan or host networking.” A container on these networks is as exposed as any machine on the LAN, or as the host itself, with whatever the app listens on open to whoever can reach it. Nothing like the bridge’s “unpublished ports are private” applies.

Choosing

Need Driver
Normal services, isolation, published ports User-defined bridge
Host’s real interfaces, huge port ranges, lowest overhead host
No network at all none
Own address on the LAN, own MAC macvlan
Own address on the LAN, one MAC, or routed subnets ipvlan
Containers across several hosts overlay, with Swarm, or an orchestrator

About the video

The embed is a 9.5-minute clip, 5:29 to 14:56, of Network Direction’s “Learn Docker Networking: Bridge vs MACVLAN vs IPVLAN”, June 2026. It covers the chapters on the none network, the host network, macvlan, creating a macvlan network, ipvlan, and ipvlan’s L2 and L3 modes, from a channel aimed at network engineers. It does not cover container: networking or the missing firewall rules, which the lesson adds. YouTube reports an English original audio track. Christian Lempa’s chapters in deeper go over host, macvlan and ipvlan with a homelab angle.

What was run: nothing, since these drivers need a Linux host and a real network. The behaviour, options and limits are from the host, none, macvlan and ipvlan driver pages, the networking overview and the packet filtering page in the docker/docs repository, checked 2026-11-28, and the l3s description from the Linux kernel’s ipvlan documentation.

Where this fits

You know every way a container can be attached. The last networking question is the reverse direction: reaching the host and the outside world from inside a container.

Check yourself

  1. 01A container started with --network host -p 8080:80 is reachable on port 80, not 8080. Why?

    In host mode the container uses the host's network stack directly. Port mapping does not apply and Docker ignores -p with a warning, so the app listens on the host's port 80.

  2. 02You put a container on a macvlan network with address 192.168.1.50. Other machines on the LAN reach it, but curl 192.168.1.50 from the Docker host itself times out. Why?

    The Linux kernel does not let a macvlan child talk to its own parent interface. Add a macvlan interface on the host with an address in that subnet, or also attach the container to a bridge network.

  3. 03Your switch port allows only one MAC address and a macvlan network breaks connectivity. Which driver avoids that, and why?

    ipvlan. Its containers share the parent interface's MAC address and are told apart by IP, so the switch sees only one MAC.

  4. 04How can a debugging container see exactly the same network as a running app container, including its localhost?

    Start it with --network container:<app>. It joins the app's network namespace, so ss, curl localhost and tcpdump see the app's own interfaces.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark