Search code examples
dockerdocker-composewifimacvlan

How can I make docker container IP addresses accessible in a WLAN?


I'm running Docker containers on a host (A) which is in a local network and gets its IP address from the WLAN router via DHCP. I'd like to access the docker containers via IP address from another host (B) which is in the same local network. I've configured a macvlan docker network in my docker compose file. However if I scan the network for IP addresses with e.g. nmap -sP XXX.XXX.XXX.0/24 with XXX.XXX.XXX as subnet mask I don't find new IP addresses. In general: Do I have to consider something special in case I create a setup like this?

Reference to a similar, simplifying question on forums.docker.com.


Solution

  • Macvlan does not generally work over wireless interfaces. It just took me hours to discover that, as it is nowhere mentioned in most macvlan documentation. See: http://hicu.be/macvlan-vs-ipvlan

    From my understanding, access points don't like getting packets from MAC addresses that haven't previously authenticated with them.

    ipvlan L2 works, just replace the macvlan driver with ipvlan and specify ipvlan_mode: 2 under driver_opts.