Can't connect to container on localhost mapped port

I have a container running on port 8002 and it is mapped to port 8002 on the host. I can see in Kitematic that it should be available on localhost:8002 but I cannot reach my test page. However, if I inspect the container and get its IP to use in place of localhost, then I can reach my test page just fine.

I’m kind of new to docker, but it was my understanding and experience with other containers that it should be reachable this way without much fuss. Is there something else that I’m missing?

Hi draepetan,

From what I can understand, this is a known behavior for Docker for Windows. As you noted, inspecting the container to get the IP is typically the best way to do it if you’re running locally. However, it’s worth noting that if your container is being accessed by a different machine (you’ve mapped the Host port to the Container port), then you can use the Host IP+Host Port combo to access the Container.

Sources: