Docker Community Forums

Share and learn in the Docker community.

How to use experimental macvlan networks on Docker for Mac?


(Mcrawford) #1

Relatively new to this… Still experimenting, can’t find an answer to this question so far.

I’m hoping to switch from using VMware Fusion to host DNS, PXE, BIND in VMs on a Mac Mini to running these services via containers via Docker for Mac Beta. This requires me to create these containers with fixed IP addresses on the Mac’s primary network. I’m currently using DHCP with mac-address reservations, but it seems that’s not yet ready with the macvlan driver, so I have to specify an IP address when I run the container.

I’ve tested this a bit on a Fusion VM running Ubuntu 16.04 within an iMac, which has the VMware NAT network and a bridged network setup, exposed within the Ubuntu VM as ens33: and ens34: respectively. After installing docker experimental, I create a network using:

docker network create -d macvlan --subnet= --gateway= --ip-range= -o parent=ens34 network1

And am then able to run a container with a specified IP on this network using:

docker run -td --name “container1” --hostname “container1”
–network=network1 --ip= alpine ash

I can then connect to the container and ping other hosts or ping this container from other hosts:

docker exec -it continer1 ash
/ # ping # ping router
/ # ping # ping other VM running on parent mac
/ # ping # ping the parent mac
/ # exit

So far, when I’m setting up the VM via Fusion inside the Mac, then installing docker myself and creating the network myself from within the docker VM, it looks like I can do what I want.

Where I’m having trouble and could use some help, is how do I do the same thing using Docker for Mac Beta? Here, I think the docker command is running on the Mac, but communicating with a VM created via Hyperkit/xhyve/bhyve running docker-engine, but I don’t know how to get in to that VM to see what interface I’d use in the docker network command as the interface to which the macvlan driver connects (i.e. “-o parent=ens34”) in my working example. I’ve tried en0 (but that’s the parent mac’s interface, not an interface on the embedded VM) or guessed at “eth0”, but neither seemed to work.

So, any idea of what I should fix in this statement:

docker network create -d macvlan --subnet= --gateway= --ip-range= -o parent=eth0 network1


  • The mac’s wired interface is en0, set to
  • I want to docker containers running network services to be in range, initially via static IP, then via defined mac address and DHCP-provided IP address once that’s ready.
  • I want to be able to reach BIND DNS servers from other HW and virtual hosts on the network


(Walid A. Shaari) #2

you seem to be doing alright with Fusion, did you try playing with docker-machine? for example

mms-iMac:~ mms$ docker-machine ls
default - virtualbox Running tcp:// v1.12.3

also check that slides, as they had some hints/warning