The docker Container and mac Host are on the Same Network Segment

  docker, question

I want the docker container to be on the same network segment as my mac host, so I used the following command:

$ docker network create -d macvlan --subnet=172.16.0.0/24 --gateway=172.16.0.1 -o parent=en0 mynet

But the tip-o parent=en0Not correct, so I ignored this parameter. Although the network was successfully created, the created container could not be connected to the Internet.

I don’t know what you are using to solve the problem of the same network segment for Mac computers.-o parent=Where did it get its value?

Thank you for inviting me. At present, I do not use mac for a series of docker operations. Because of the problem of mirroring, I use boot2docker’s virtual machine created by docker-machine for Docker operations on both Mac and windows.

I have just performed the operation on the mac direct host, which seems to be an error, indicating en0 cannot find it and does not support it. I do not know whether this is a restriction under the mac, but I have used it on boot2docker and it is absolutely no problem, so I can only suggest that you try to switch to docker-machine for testing.

If you want to solve this problem, the official docs search should be able to find the relevant answer.