Limitations of Windows containers for localhost and published ports

668 views Asked by At

I've read the section "Limitations of Windows containers for localhost and published ports" from docs.docker.com and understood that I need to use the container IP to be able to access to port80 of my container on DockerForWindows.

Howerwise I'm not able to browse the container IP using http://172.14.0.2 or even ping from my Windows host.

docker file = https://github.com/cjonesdev/docker-amazonlinux-lamp/blob/master/Dockerfile

docker run = docker run -ti --name lamp -p 80:80 -p 443:443 -p 3306:3306 -v D:\Dropbox\www:/var/www/html -d amazonlinux6

docker ps result = 989094308f8c amazonlinux "/bin/bash" 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:3306->3306/tcp lamp

From the docs.docker.com I guess that it's implicite that the Windows Host should be able to nat the container IP by default, unfortunately in my case it's not.

Following a similar conversation : https://github.com/docker/for-win/issues/221 it's look like in some case a Windows route need to be added in order to communicate properly with the DockerNat and the containerIP.

I've tried the following route add without success :

route /P add 172.17.0.0 MASK 255.255.0.0 10.0.75.1 (IP dockerNat)

route /P add 172.0.0.0 MASK 255.0.0.0 192.168.0.13 (IP windowsHost)

Does anyone already facing a similar situation? Thanks for the help.

0

There are 0 answers