Unable to access localhost?

I’m just trying to learn Docker and going through the getting started tutorial with Docker Desktop (for Windows)

I ran the getting-started container in my terminal as it says to do, then trying to access in Chrome on localhost as the tutorial says to do but nothing loads.

There’s nothing in the documentation about this. It just says “run the command” “Access through your browser.”

Great…well, it’s not working, so what do I do?

Hello,

I don’t know

  • which tutotial you tried (please provide link),
  • what command you entered to start the container (please provide exact command),
  • if the container is running (output from command docker ps -a) and
  • what URL you entered into your browser.

therefore it is really hard to find out what is going on/going wrong.

Here are some steps I would do for troubleshooting:

  • The first thing I would check is the status of the container - is it running or not. If not - check why (docker log <containername>)
  • Then I might check if the port provided by the service running inside the container is forwarded to the outside world (using docker-command’s parameter -p).
  • What URL is used in the browser? Have I used the port used by the service in the container (which is wrong) or the port forwarded from the outside-world (which should be OK).
1 Like

I guess you tried the “getting-started” container that can be started by going through the “Quick start guide” from Docker Desktop. Which version of Docker Desktop are you using?

Mine is 4.15.0. I am still on my macOS and not my Windows 11, but it worked on macOS. This is the screen I see at the end of the quick start guide:

By clicking on the blue icon it opened localhost/tutorial in my browser. If it is not opening in your browser, the suggestions of @matthiasradde can help you to get more information.

Maybe there is a service listening on port 80 on your Windows, but the container could start since that port was not used inside the virtual machine of Docker Desktop. It should still fail, but if it doesn’t, that other service can be the reason of the issue. You could try to use a different host port, but I know, Docker Desktop does not allow you to change the command before executing it unless you copy paste the command manually instead of clicking on the commands to insert them automatically.