mirror of
https://github.com/sickcodes/Docker-OSX.git
synced 2026-01-11 21:10:25 +01:00
Bridged Networking or User mode? Replace ebtables & iptables with iptables-nft to allow bridged networking. #61
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 @sickcodes on GitHub (Jul 25, 2020).
Here are the two types of networking
user mode
The image has the same IP as your Docker IP
ip nto see neighborsQEMU cannot be reached unless you add ports in the QEMU args during "docker run"
Can't expose Docker ports on a running container (AFAIK), you have to start a new image and move the installation around.
You also have to edit the Launch.sh or add in arguments
bridged mode
The image will run on the container's own internal network, like 10.0.2.15 or something or 192.168.122.11x
After that, you can ssh OR docker exec into the Docker and then ssh into the QEMU image.
which is better?
Realistically, they both appear exactly the same.
Bridge mode would let people forward all connections to the bridge IP.
If anyone wants to test it out:
The actual bug is ebtalbes + dnsmasq doesn't work virsh networking.
You can test it out:
Bugged:
Fix:
It's a strange bug, I though related to polkit, however, I found it incompatible with ebtables.
Possibly just with Arch, that the default network doesn't get installed.
Easy fix: replace iptables and ebtables with iptables-nft. If not, virsh hangs, sudo virsh hangs.
On the other hand, QEMU and Docker networking is really, really easy to debug. If bridged network is added, you'd have to start the bridge every time, I also think you need
--net host@Julioevm commented on GitHub (Aug 4, 2020):
I was having issues with other machines communicating with a program running inside the macos docker, this might have something to do with it. If I get some free time ill try some of this stuff.
@sickcodes commented on GitHub (Aug 4, 2020):
If you use the two -net command strings above in the xml file while using virt-manager you can switch between bridged and userMode networking. Haven't done bridged in the dockerfile but it wouldn't be much more than whats already here.
In summary:
Use virt-manager without docker
Load the xml file from OSX-KVM
Try the networking commands above
Otherwise you can just add more ports to the QEMU command using the -e EXTRA env variable and also forwarding it again as a normal -p 111:2222 to the docker command.
@sickcodes commented on GitHub (Jan 8, 2021):
Replaced iptables with iptables-nft
8d6d0359b1@sickcodes commented on GitHub (Feb 8, 2021):
e1000-82545em is preventing iMessage from working on Catalina and abovehttps://forums.unraid.net/topic/84288-catalina-network-bridging-weirdness/?do=findComment&comment=781612However, a fix is available here: https://github.com/chris1111/AppleIntelE1000e@mikob commented on GitHub (Mar 2, 2021):
Couldn't get this working. Trying to have a port shared so that the host can access a server running on the mac on port 8080.
-e EXTRA='-netdev user,hostfwd=tcp::8080-:8080'This produces: qemu-system-x86_64: Parameter 'id' is missing
-e EXTRA='-netdev user,id=net0,hostfwd=tcp::8080-:8080'This produces: Duplicate ID 'net0' for netdev
-p 8080:8080 -e EXTRA='-netdev user,id=net1,hostfwd=tcp::8080-:8080'(qemu) qemu-system-x86_64: warning: netdev net1 has no peer
let's the container run... but can't access the port on the host :/
@sickcodes commented on GitHub (Mar 2, 2021):
I switched master to
vmxnet3in https://github.com/sickcodes/Docker-OSX/pull/160 as it did not affect iMessage and it massively increases speed.@mikob commented on GitHub (Mar 2, 2021):
@sickcodes Just unsure how to get port forwarding working. I suppose worst case scenario I can just forward via an ssh tunnel.
@sickcodes commented on GitHub (Mar 2, 2021):
Maybe we can add another ${ADDITIONAL_PORTS} at the end of the line that has 5900 in it too for any other networking arguments for that interface
@sickcodes commented on GitHub (Mar 2, 2021):
At the end of this line: https://github.com/sickcodes/Docker-OSX/blob/master/Dockerfile#L228
I'll add it in shortly
@sickcodes commented on GitHub (Mar 2, 2021):
@mikob Added https://github.com/sickcodes/Docker-OSX/pull/162 let me test and then merge
@mikob commented on GitHub (Mar 3, 2021):
@sickcodes just tested it out, it works! Thanks for your really speedy response!
@sickcodes commented on GitHub (Mar 3, 2021):
@mikob No problem!
Here is a worked example for anyone else reading, as written here: https://github.com/sickcodes/Docker-OSX/pull/162#issuecomment-789490227
On the host
Inside the container:
nginx should appear on the host at port 10023
@mikob commented on GitHub (Mar 3, 2021):
P.S. you don't need to install nginx for a test server, you can just do eg.
python3 -m http.server 8080to spin up a static test server that serves the CWD and it ships with python by default, which ships with osx by default.@TimVanDyke commented on GitHub (Aug 15, 2023):
I am unable to run:
without getting several errors. However, I believe this is the solution to the problems I'm having. Any help would be appreciated.
Output:
Here is my docker compose: