Search code examples
dockerjenkinsnetwork-programmingboot2docker

How to make docker instance accessible from the outside network


Thanks for reading the post.

I have a windows7 host, on which I have a boot2docker installed. And via the boot2docker, I created a docker jenkins container.

Now, on my windows7 machine, I am able to access the jenkins page by hitting the url http://192.168.99.100:8080 (because:

  1. I exposed(published) the 8080 port of the "Jenkins" to the boot2docker's 8080.
  2. boot2docker has an ip 192.168.99.100

  3. the windows 7 machine has a 192.168.99.1 which connects to the boot2docker.)

My windows 7 is also on a larger company network and say it is assigned an ip of: 10.49.33.1.

My question is: What should I do to make the jenkins accessible to hosts on the 10.49.33.1/16 network? (I appreciate if you could provide instructions in details as much as possible.)

thanks,


Solution

  • I found the missing piece to solve my problem.

    Now I rethink about it, the issue I was facing can be described as How to make a host-only ip:port accessible to the outside when the host is a windows 7 machine.

    Now what solved my problem is "windows built-in port forwarding".

    I need to open up a port (whatever unused port, I will use 10411 as an example) at the public ip (in this case: 10.49.33.1) of my windows 7 host and then forward all traffics to the host-only side (in this case 192.168.99.100:8080).

    1. start up a cmd.exe 2. type the following command to perform port forwarding. netsh interface portproxy add v4tov4 listenport=10411 listenaddress=10.49.33.1 connectport=8080 connectaddress=192.168.99.100 3. Done. I am able to type 10.49.33.1:10411 into a browser and see my jenkins!

    To remove the port forwarding, use the following command: netsh interface portproxy delete v4tov4 listenport=10411 listenaddress=10.49.33.1