Docker – localhost not working on Windows

windowsBug


I recently publish a post about „How to configure docker on Windows”. But after some windows update, localhost processing stopped working.

Example

Let us look at the example with the same dockerfile.

After building the image and turning it on. We are getting information that our application is working on port :5000

docker stop working

But if we try to run it on http://localhost:5000/ , our website is not responding.

Not responding

Let’s look at what docker ip works on. To do this we need to enter the docker inspect command plus name of our image. In our case:

docker inspect

On this ip our application works!

docker windows

So what happend?

This is described in detail HERE.

But in brief:

Container endpoints are only reachable from the Windows host using the container’s IP and port.

We must admit that the natural environment for a docker is linux. That’s why many windows updates can make us bloody in future, so in my opinion the best environment for hosting applications is linux (especially the core version allows us to do so).

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *