简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM