-1

I'm aware of this approach but I was already able to run Docker fine using the "traditional" way.

Basically, I installed Docker in 3 layers:

  • Docker (Container living inside of Vagrant/CentOS)
  • Vagrant (CentOS) (Guest OS on Windows 7)
  • Windows 7 ("Mother" Host OS)

I can access a Docker container instance on the host OS (Windows) just fine via <vagrant IP>:<port> e.g., 192.168.1.200:9000.

How can I map this ip:port combination on the Windows hosts file so I can access the docker container via docker-app.test? E.g., Putting 192.168.1.200:9000 docker-app.test on the hosts file doesn't work.

I'm also open to other ideas to achieve what I'm trying to do.

IMB
  • 15,163
  • 19
  • 82
  • 140

1 Answers1

0

The windows host file can is only used for name resolution, ports can't be specified there.

In order to remap the ports you need some kind of proxy, third party tools like apache or nginx can do the job, but since you are on windows netsh can proxy the port without any third party tools.

danielorn
  • 5,254
  • 1
  • 18
  • 31
  • This looks like it should work but unfortunately it doesn't work for me. `netsh interface portproxy add v4tov4 listenport=9000 listenaddress=192.168.1.200 connectport=9000 connectaddress=192.168.1.200` I tried interchanging the values too. – IMB Jan 06 '19 at 03:37
  • `netsh interface portproxy add v4tov4 listenport=80 listenaddress=192.168.1.200 connectport=9000 connectaddress=192.168.1.200` also don't work. – IMB Jan 06 '19 at 03:52