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

JP Staub picture JP Staub · Apr 28, 2016 · Viewed 7.4k times · Source

The Setup:

  • Computer A - This is where the Docker-Machine "default" runs under VirtualBox. "default" is running a container called "Odoo". "default" was created using Docker's installation process. "Odoo" was created using Odoo's installation process.
  • Computer B - This is a computer on the same Local Area Network (LAN) as Computer A.
  • Router - This connects Computer A and Computer B together on the LAN.

The Software:

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

The Problem:

  • Odoo is accessible on Computer A using "default's" IP address plus Odoo's associated port number. An example of the address is: 192.168.99.101:8069.
  • Odoo is NOT accessible on Computer B using "default's" IP address plus Odoo's associated port number.

The Question:

  • How is the VirtualBox environment configured such that Computer B can access Odoo on the LAN?

Answer

Awakening Byte picture Awakening Byte · Apr 29, 2016

That 192.168.99.101 is Docker host’s IP address internal to Computer A. You only need to config port forwarding from defaut's port 8069 to host machine' port 8069. Then odoo will be accessible by computer B with computer A's ip address(ex: 10.0.1.22) plus port 8069. Since both computers are within the same network, you shouldn't need to change settings of your router(except firewall settings, if there is any)

10.0.1.22:8069

Port forwarding need to be set in virtulbox settings

enter image description here

enter image description here