Skip to content
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

Support "bridged" network mode #41

Closed
sheerun opened this issue Feb 17, 2016 · 6 comments
Closed

Support "bridged" network mode #41

sheerun opened this issue Feb 17, 2016 · 6 comments

Comments

@sheerun
Copy link

sheerun commented Feb 17, 2016

Hey

This driver for now uses /Library/Preferences/Parallels/parallels_dhcp_leases that shows ip assigned by parallels' dhcp. I changed network mode of contained to "bridge" so my containers are exposed in local network, but docker-machine ip still shows old ip address from parallels_dhcp_leases.

Could you implement support for bridged mode, please?

@legal90
Copy link
Collaborator

legal90 commented Feb 26, 2016

Hi @sheerun
Thank you for request! Like in Vagrant provider, here in Machine driver we use "Shared" network type by default, because it works for everybody and it doesn't depend on any external conditions.
However, "Bridged" mode depends on the configuration of a network, which the host machine is currently connected to. There could be a static IP in some specific subnet or an auto-configuration by DHCP, or the host could be just off-line, so the network could be even not configured.

Adding "bridged" mode as an additional option sounds good, and we're open for Pull-Requests allowing this. But honestly, I'm not sure how it could lay on the Docker Machine workflow.
Also I'm looking forward to the way how the similar feature will be implemented in the upstream Docker Machine for the VirtualBox driver: docker/machine#1491

At the moment, I recommend you to add a second network adapter with a type "Bridge", because reconfiguring of the existing one will brake the Docker Machine driver - it won't be able to connect to the VM.

@dersimn
Copy link

dersimn commented Feb 9, 2017

+1

@Elhodred
Copy link

Elhodred commented Mar 27, 2017

Adding a second adapter works only if you access your containers from the same network configured in the bridge interface.
This is due the fact that you will end up with 2 default routes in the routing table:
docker@default:~$ ip route list
default via 10.211.55.1 dev eth0 metric 1
default via 192.168.1.1 dev eth1 metric 1

I don't find a way to remove persistently the "wrong" default route to make my setup working.
Is there a way to reconfigure the VM to have only one interface in a way that the connection from docker-machine is not broken?

@HunterDG
Copy link

HunterDG commented Jun 24, 2019

+1

Glad I found this issue!

Workaround:
docker-machine create --driver parallels default
docker machine env to find the "Shared" IP
docker-machine stop
change the network interface to bridged in parallels config, then manually start the VM
run ip a or ifconfig in the docker VM to find new bridged IP
replace "Shared" with bridged IP in /Library/Preferences/Parallels/parallels_dhcp_leases, save file
docker-machine regenerate-certs default
docker-machine env

Voila! :) now I can run homebridge in docker on mac! (until DHCP lease changes on bridged network, or parallels decides to overwrite the dhcp leases file)

EDIT: lock the DHCP leases file if you don't have/intend to create any new VMs with shared network interfaces.

Alternative more permanent workaround I haven't tried (and assuming no other VMs use shared networking) could be to set a DHCP reservation in the bridged network DHCP server, then modify Parallels "Shared" network DHCP prefs to hand out only that IP address. Then you'd theoretically only need to change the network interface to bridged, and presumably Parallels wouldn't overwrite the DHCP leases file.

@legal90
Copy link
Collaborator

legal90 commented Oct 14, 2020

Hi all,
Since Docker Machine was put into the maintenance mode (docker/machine#4537) there is almost no chance that the Bridge network support will be officially added there (docker/machine#1491).
Therefore, we are not going to implement it in parallels driver neither.

For those of you, who still need that, I would recommend using the workaround posted by @HunterDG in the comment above.

@legal90 legal90 closed this as completed Oct 14, 2020
@HunterDG
Copy link

HunterDG commented Feb 8, 2021

FYI - not explicitly related to this issue, but relevant to my need at the time (homebridge/other containers that require bridged (net=host) don't work in Docker Desktop)...

There is now a homebridge-vm-image that negates the need for docker-machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants