11

I am using Docker Quickstart Terminal to run a docker container. The container should work on port 8088 of localhost:

 docker run -it --name myContainer -p 8088:8088

However, when I go to localhost:8088 or 127.0.0.1:8088 I can't find any process running.

This works on OSX.

Why is this not working on Windows?

bsky
  • 19,326
  • 49
  • 155
  • 270
  • Your question was about localhost: if you want localhost to work, you need to port-forward as I have mentioned. If not, a docker machine ip would show you the actual VM IP. – VonC Dec 18 '16 at 15:38

2 Answers2

17

I'm assuming you're using VirtualBox, since that's what is integrated with the Quickstart terminal.

The reason it doesn't work is that Windows isn't running your (Linux) containers natively, it's running them in a separate Linux-based VM. This VM is available under a different ip address than your "physical" machine, usually printed when you start the quickstart terminal:

enter image description here

This is the ip address you need to use in order to connect to published container ports.

Trondh
  • 3,221
  • 1
  • 25
  • 34
3

One possibility is the kind of VM you are using : HyperV (Docker For Windows) or VirtualBox (Docker Toolbox).

If it is the later (which seems probable since you are using the Docker Quickstart Terminal), you need to port forward 8088 in order for your PC (localhost) to see it.
See "How do I configure docker compose to expose ports correctly?" as an example when using VirtualBox.

If localhost does not work, a docker-machine ip will show you the ip of the VM being executed.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250