[Fixed]-Connect docker container (django app) to windows lan

1👍

What finally worked for me was the following:

Virtualbox setup

  • I deleted the former virtual env because I was unsure of all of the tinkering I had done to that point
  • docker-machine create -d virtualbox default # to create new virtual machine
  • power off default virtual machine
  • choose settings, network Adapter 3, enable network adapter
  • choose bridged network, note the mac address that shows up
  • set promiscuous mode to allow all
  • click ok
  • docker-machine start default

Virtualbox settings

  • Show the VM screen (either headless start, or show)
  • adduser # this is for the ssh test so strictly not necessary
  • type ifconfig and find whichever ethernet has the mac address you noted above usually either eth0 or eth1 (also take a look at the inet addr)
  • use Putty (from windows) to ssh whateveryourname@inetaddr
  • type in the password for the user you created, and you should be able to ssh into the VM now
    – Setting the static IP
  • in the bash type: sudo ifconfig eth1 netmask 255.255.255.0
  • type ifconfig to check if it changed
    – Application
  • run your docker-compose script and access the application on staticIP:port# or just staticIP from your LAN depending on how NGINX is setup

Leave a comment