Access Docker Container URL on Windows Host

Caveat # 1: I read this answer , this answer , as well as other miriad answers / messages, and I still can't get it to work.

Caveat # 2: I'm new to docker, so I probably missed something very simple.

I run Docker on Windows and this is an ELK image launched with this command:

sudo docker run -p 5601:5601 -p 9200:9200 -p 5000:5000 -it --name elk sebp/elk

I'm trying to get access to ports 5601and 9200from a browser running on Windows, and keep getting a connection timeout. Here is what I did:

  • I believe that the command docker run(above) forwards ports 5601 and 9200 from the container to the host docker (boot2docker VM) already, so this should be fine.
  • I got the IP address of the moose dock container by running docker inspect $(docker ps -q) | grep IPAdocker in the CLI. It turned out 172.17.0.9. Then I launched curl 172.17.0.9:5601and curl 172.17.0.9:9200. I was able to get the correct HTML responses from these URLs. This allowed me to verify that everything is working correctly in the docker container / hostel.
  • Then I got the IP address of the dock by running docker-machine ip default. It turned out to be 192.168.99.100. I believe that this is all I need to access the moose container from the docker host (in this case Windows), since port forwarding for the container is already installed. With this IP address I tried to go to http://192.168.99.100:5601and http://192.168.99.100:9200, and I got ERR_CONNECTION_TIMED_OUT. I also tried using IE and even httpsfor kicks, and still have no luck.
  • 192.168.99.100 DOS, . Windows ( ), .

?

+4
2

Ubuntu VM, , , .

, , .

1. Enabled routing as told in the above post 
2. Added a port forwarding from windows host to Ubuntu host where the containers are hosted by using below command 

     netsh interface portproxy add v4tov4 listenport=4422 listenaddress=192.168.1.111 connectport=3128 connectaddress=192.168.0.33

    a. Here 192.168.1.111 is my windows host ip address and 4422 is the port to where other machines in same network will call 
    b. Here 192.168.0.33 is the ubuntu host where containers are hosted and 3128 is the ubuntu host port which is mapped to the container 
        $ docker ps -a
        CONTAINER ID        IMAGE                     COMMAND                 CREATED
                  STATUS              PORTS                    NAMES
        090af3e0c7a4        sameersbn/squid:3.3.8-5   "/sbin/entrypoint.sh"   6 hours ag
        o         Up 5 hours          0.0.0.0:3128->3239/tcp   squid

3. Then I added firewall to unblock inbound and outbound traffic for 4422 port in my windows host  

:)

+4

, 127.0.0.1: http://127.0.0.1:5601 http://127.0.0.1:9200

http://192.168.99.100:5601 http://192.168.99.100:9200, Windows, .

cmd command. CMD , . regedit. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter, "". 0 1 .

services.msc . "". "" "", . http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/how-to-enable-ip-routing-in-windows-7/8970e722-e947-460d-80d5-fd6ffc850f3f?auth=1

+1

Source: https://habr.com/ru/post/1610467/


All Articles