3

I'm totally new to docker and I tried to run the example image from the "get started" tutorial.

My OS is Windows 10 Home (64 bit) and I used Docker Toolbox to install it. I created the 3 files like the demo told me to do and copied the content into them to avoid typing errors. When I start the image with docker run -p 4000:80 friendlyhello

there seems to be no problem, but when I try to connect in the browser with localhost:4000 the browser (Google Chrome most actual version) tells me that localhost refuses the connection. Even with Microsoft Edge the same error appears.

I also tried to change the windows firewall with an ingoing rule to allow the docker-engine.exe all ports, but it did not help.

Has anyone a hint for me how to solve the problem? I really want to get the example run :-)

Link to the get started example: https://docs.docker.com/get-started/part2/#pull-and-run-the-image-from-the-remote-repository

The docker process is also running: enter image description here

Update: It seems that I had the wrong version of OracleVM VirtualBox installed, and that the starting of the default VM didn't work because of an error. I installed a newer version and started the default image again and it worked.

After starting the docker container with: docker run -d -p 4000:80 friendlyhello

I was able to call the demo app inside the VirtualBox with port 4000:enter image description here

unfortunately this leaves me behind totally confused about how docker should work :-/. I thought after running docker I would be able to access it on my Windows OS because it's just another process but now it seems I still need a virtual machine? Can someone please explain me what I'm missing at this point?

the hand of NOD
  • 1,639
  • 1
  • 18
  • 30

1 Answers1

6

You need to run the following command with your container name to obtain the IP for the container.

docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_name>

You can then access the container http://IP_Obtained:Port.

Detailed Explanation can be found at https://docs.docker.com/docker-for-windows/troubleshoot/#limitations-of-windows-containers-for-localhost-and-published-ports

priyaranjan
  • 129
  • 3
  • `docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' laradock_workspace_1` results in `172.20.0.4172.19.0.2` for me, which looks unlike IP addresses that I'm accustomed to. http://172.20.0.4172.19.0.2:80 resulted in "This site can’t be reached 172.20.0.4172.19.0.2’s server IP address could not be found." – Ryan Jul 09 '18 at 15:44
  • 2
    "docker-machine ip default" command works for me while running docker in toolbox – Danila Polevshchikov Sep 10 '18 at 14:20