-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bridged Networking or User mode? Replace ebtables & iptables with iptables-nft to allow bridged networking. #72
Comments
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. |
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 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. |
Replaced iptables with iptables-nft |
|
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.
|
I switched master to |
@sickcodes Just unsure how to get port forwarding working. I suppose worst case scenario I can just forward via an ssh tunnel. |
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 |
At the end of this line: https://github.com/sickcodes/Docker-OSX/blob/master/Dockerfile#L228 I'll add it in shortly |
@sickcodes just tested it out, it works! Thanks for your really speedy response! |
@mikob No problem! Here is a worked example for anyone else reading, as written here: #162 (comment) On the host docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-e ADDITIONAL_PORTS='hostfwd=tcp::10023-:80,' \
-p 10023:10023 \
sickcodes/docker-osx:auto Inside the container: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install nginx
sudo sed -i -e 's/8080/80/' /usr/local/etc/nginx/nginx.conf
# sudo nginx -s stop
sudo nginx nginx should appear on the host at port 10023 |
P.S. you don't need to install nginx for a test server, you can just do eg. |
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:
|
Here are the two types of networking
user mode
The image has the same IP as your Docker IP
ip n
to 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
The text was updated successfully, but these errors were encountered: