2

I have installed docker toolbox on a windows machine, after running a container with the following command, I didn't see anything listening on my host machine's specified port (82).

docker run -ti -p 82:80 --name=container_alias someprovider/image:some_tag

I did attach to this contianer and did a simple check inside the container using:

curl localhost:80

it did return html source content, which means the container is running properly. What could be the reason of this unexpected behavior?

Sajuuk
  • 2,667
  • 3
  • 22
  • 34
  • 1
    What's the output of `docker-machine ip`? Docker won't be listening on `localhost` as your using Docker toolbox which uses Virtualbox and it's networking. Only Docker for Windows can listen on `localhost` because it uses Hyper-V. – syncdk Jul 05 '17 at 22:13

1 Answers1

0

My guess is you have another server set-up on localhost but I can't be sure. Docker Machine doesn't map to localhost. Unless you've somehow set-up localhost to redirect to the IP address of your docker machine.

You may want to read Get started with Docker Machine and a local VM .

Also -p 82:80 exposes the container's port 80 to the machine's port 82. So you would need to curl someipaddress:82

Mano Marks
  • 8,761
  • 3
  • 27
  • 28
  • to be clear I was inside the container, so I curled against port 80. on the host machine it's just connection refused on port 82. – Sajuuk Jul 06 '17 at 06:19
  • Ah ok sorry misread that. In the container, what ip address are you running on? If you set it to 0.0.0.0 does that fix it? – Mano Marks Jul 06 '17 at 06:24