How to connect to the docker container from the host (same network) [OSX 10.11]

Setup:

  • Computer A is where the Docker-Machine "by default" runs under VirtualBox. "default" launches a container called "Odoo". "default" was created using the Docker installation process . "Ode" was created using the Odoo installation process .
  • Computer B is a computer on the same local area network (LAN) as computer A.
  • Router - This connects computer A and computer B together on a local network.

Software:

  • Computer A - OSX 10.11.3 / VirtualBox 5.0.18 / Docker 1.11
  • Computer B - Windows 7 / Firefox
  • Router - ASUSWRT

Problem:

  • Access to Odoo is available on computer A using the default IP address plus the associated Odoo port number. An example of an address is: 192.168.99.101:8069.
  • Odoo is NOT ALLOWED on computer B using the default IP address plus the port number associated with Odu.

Question:

  • How is the VirtualBox environment configured so that computer B can access Odoo on the local network?
+7
docker lan macos
source share
2 answers

That 192.168.99.101 is the Docker IP address is internal to computer A. You only need to configure port forwarding from defaut port 8069 to port 8069 on the host machine. Then odoo computer B will be available with computer A ip-address (for example: 10.0.1.22) plus port 8069. Since both computers are on the same network, you do not need to change your router settings (except for the firewall settings, if any)

 10.0.1.22:8069 

Port forwarding must be set in virtulbox settings

enter image description here

enter image description here

+6
source share

Attention!

A solution that involves changing network adapter 1 is much easier to implement. This is the recommended solution.

Background:

When Docker is installed, a virtual machine (VM), known as the "default", is created inside VirtualBox. Inside VirtualBox, Docker sets up a network configuration that allows the host computer (computer A) to access the default containers through the docker's ip device. But computer B cannot access the same containers through the docker's ip device.

The main process:

Adjust the default virtual machine settings

  • Open the VirtualBox GUI.
  • See the list of virtual machines on the left side of the graphical interface.
  • Click "default" (or the virtual machine you want to change)
  • Click the Settings icon (transmission object)
  • Follow the screenshots. Note. If using a network cable to connect to a local network, select en0, not en1. The MAC address has been deleted for the screenshot. enter image description here

    Run the default VM

    For Macs, the easiest way to start the default virtual virtual machine is by clicking on the Docker QuickStart terminal icon.

enter image description here

After waiting a minute or two, you will be presented with a splash screen that includes the default IP address. This is NOT the BN-IP you are looking for. enter image description here

Find the default BN IP address of the virtual machine

This is the part that the key kept me for hours. Fortunately, there are good network discovery instructions. Run the instructions in the Docker terminal and enter the address "default.YourLANDomain". It will look something like this:


default.ripcord.lan (192.168.1.93) in x: x: xx: xx: xx: xx on en1 ifscope [ethernet]

Note the "default" part of the above address. This is the name of the Docker VM. Convenient for identifying people.

If the above does not work to find the default BN-IP for the virtual machine, you may be lucky to look at what your router sees (see the example below). Please note that "jakes-macbook" has the annotation "2" next to the device icon. This means that two clients are associated with this icon. 192.168.1.24 is not the default BN-IP for the virtual machine. The IP address will switch back and forth (at odd times). The other address, 192.168.1.93, is the default BN-IP for the virtual machine.
enter image description here

Rest of the endless story

Launch the Odoo container, then access it using computer B at the BN IP address of 192.168.1.93:8069 (for example). Big success! Let's hope....

Troubleshooting

Use ping to try to find out if BN-IP is active for the virtual virtual machine and from there for this method to work. For a cleaner solution, see Network adapter 1 modification method. This is a much simpler implementation method.

+3
source share

All Articles