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 prompt -o parent=en0 was incorrect, so I ignored this parameter. Although the network was created successfully, the created container could not access the Internet.
I don’t know what everyone uses to solve the problem of the same network segment for Mac computers. -o parent= Where did it get its value?
阿神2017-05-31 10:37:04
You can get all the network cards of this machine through the ifconfig command in the terminal
Then find and replace en0
(My personal experience is that IPv4 is assigned. If you still have problems, you can go to System Preferences - Network - Find the - Advanced - Hardware you are using to get the MAC address, and then look at the MAC comparison just now)
阿神2017-05-31 10:37:04
Thank you for the invitation. At present, I do not use mac to perform a series of docker operations. Because of the image problem, I use the boot2docker virtual machine created by docker-machine to perform docker operations on both mac and windows.
I just performed the direct host operation on mac, and it seems that it also reported an error, saying that en0 cannot be found and is not supported. I don’t know if this is a limitation of mac, but I have used it on boot2docker and it is completely fine. So I can only suggest you try switching to docker-machine to experiment.
If you want to solve this problem, you should be able to find the relevant answer by searching the official docs