Is there a workaround to use the host's network in Docker for Mac?

非 Y 不嫁゛ 提交于 2019-12-23 19:40:45

问题


Since Docker for Mac does not use Virtualbox but rather uses xhyve there is no straightforward way to access my mac's network (specifically for VPN and network attached devices) using network_mode: host or --network host.

I've searched and searched but have found no simple workaround. The best solution I've figured out is to run a Linux virtualbox then install docker on that and execute docker-compose up or docker run in there. Not ideal at all.


回答1:


This doesn't seem to be possible. There are some limitation in docker for mac. https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds

On the other hand, starting a VM and installing docker on it might not help. With network mode as host, the container will use directly the network interfaces for the VM and not those of the MAC host. So you will end up in a case similar to that of using docker directly on your mac machine.



来源:https://stackoverflow.com/questions/46286741/is-there-a-workaround-to-use-the-hosts-network-in-docker-for-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!