Im trying to automate a docker run shell script that needs to spin up an X11 app running on a docker-machine VM with virtualbox driver on OSX/mac. To get the x11 app to forward the X11 display to the desktop host i need to get the ip address of the correct vboxnet* (i assume) network interface (not the docker ip) and export that ip into the docker container.
what i am currently doing is assuming that the docker-machine VM ip is tied to the "vboxnet1" interface name and regexp'ing it out of ifconfig.
i see that the virtualbox DHCP process that spins up when i start docker-machine has a trunk name that corresponds to the interface i want - but again this seems like an assumption and i would think there is some command i could run to be certain which address it is so my docker run script will work on any machine.
/Applications/VirtualBox.app/Contents/MacOS/VBoxNetDHCP --ip-address
192.168.99.2 --lower-ip 192.168.99.100 --mac-address XXXXXXXXXXX
--netmask 255.255.255.0 --network HostInterfaceNetworking-vboxnet1
--trunk-name vboxnet1 --trunk-type netadp --upper-ip 192.168.99.254
Is there a way to definitively determine which network interface to find the ip address?