mirror of
https://github.com/sickcodes/Docker-OSX.git
synced 2026-01-12 05:20:27 +01:00
How do I grant the same network access to the Mac VM as the underlying Arch Linux Host #126
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Buzz-Lightyear on GitHub (Mar 11, 2021).
When I docker run using the following command:
I can ensure that the Arch Linux container has the same network access as my host machine. However, the Mac VM does not share the same network access. How can I resolve this? I verified that ipv4 forward is already set to 1:
@sickcodes commented on GitHub (Mar 11, 2021):
See this https://github.com/sickcodes/Docker-OSX/issues/72
In bridged networking you need to start a bridge inside the container /dev/run stuff.
We use user mode networking and forward ports to the machine because otherwise the guest has the same IP as the container and won't be able to SSH in.
@sickcodes commented on GitHub (Mar 11, 2021):
Also, vmxnet3 is on by default now, do a speed test inside the container.
To open more ports, see line 233 https://github.com/sickcodes/Docker-OSX/blob/master/Dockerfile
@Buzz-Lightyear commented on GitHub (Mar 11, 2021):
Thanks for the speedy response @sickcodes, I removed the
vmxnet3parameter. I went through #72 and specifically https://github.com/sickcodes/Docker-OSX/pull/162#issuecomment-789490227 but I can't replicate the "Inside the Container" part you're referring to.This is how I created the container:
However the Arch Linux VM doesn't have the same network access as my host. To access the Mac VM, I SSH-ed into localhost via port 50922:
And obviously I can't curl Homebrew in. I read about bridged vs user mode networking and don't have clarity around the exact fit for me. I'm completely new to containerization, so I apologize in advance if I'm all over the place.
What I need is a way to create the Docker container from my CentOS host and let the Mac VM have the same network access as my host. When I use
--network=host, I'm able to achieve that with the Arch Linux VM but not the Mac inside QEMU. Could you walk me through the steps involved here?@shifujun commented on GitHub (Mar 12, 2021):
Maybe same DNS problem.
Originally posted by @shifujun in https://github.com/sickcodes/Docker-OSX/issues/122#issuecomment-760026655
@sickcodes commented on GitHub (Mar 12, 2021):
Do you have internet inside any Docker container? VPN on? This sounds like a local issue.
Run
ip link; ip addr; ip nand post some output here so we can see your networking setup.cat /etc/resolv.conf; cat /etc/hosts@Buzz-Lightyear commented on GitHub (Mar 12, 2021):
I'm on a corporate network and don't have internet access from my host machine but do have intranet access. At this moment, I'd merely like the Mac VM to the have the same network access as the host machine, which I'm checking by pinging the artifactory.
@sickcodes commented on GitHub (Mar 12, 2021):
You might not get far without internet unless you use the auto image.
Honestly, without knowing much about your networking setup, probably just need to route docker0 thru your intranet interface. Do it using iptables or ip.
As much as I'd like to help, I'd find out: "how to route Docker through VPN/Intranet/bridge"
@Buzz-Lightyear commented on GitHub (Mar 12, 2021):
Absolutely, thanks for the pointers @sickcodes!
@Buzz-Lightyear commented on GitHub (Mar 13, 2021):
As it turns out, I had network access from the Mac VM all along when I used
--net=host. I was thrown off becausepingreported that the destination port was unreachable. However, I was able tocurlthe resources I needed over intranet from the same URL