You might want to map a running docker container to your localhost’s port, but you can’t. For example, you run your image with
docker run -p 8080:8080 myImage
and expect to hit the docker container at http://localhost:8080 … but that doesn’t work.
In Windows, because Docker runs as a VM, it’s localhost refers to the VM’s localhost.
To find out the VM’s ipaddress, run this command
docker-machine ip default
sample output: 192.168.99.100
then you can access the image at http://192.168.99.100:8080