Docker Community Forums

Share and learn in the Docker community.

Can't connect to container via localhost

(Samuel88835) #1

On step 5 of
I ran docker run -d -p 80:80 --name webserver nginx

opening up localhost in chrome gave me ERR_CONNECTION_REFUSED

docker ps tells me that the port is still>80/tcp yet i can’t get to it by localhost

I looked at it on kitematic and the published port was got me to the right nginx welcome page

any idea why the container wasn’t on localhost?

(David Maze) #2

Because you’re running Docker Toolbox. If you can’t run the native Docker for Windows, then Docker Toolbox will (via Docker Machine) create a Linux virtual machine that can run Linux containers, and everything published with docker run -p parameters will show up on that VM and not your physical host. That VM almost always is

(P.S.: be careful saying “localhost” around Docker: it does not mean your physical hardware)

(Samuel88835) #3

okay, this makes much more sense now.
I used chocolatey to download docker so I didn’t realize what I got wasn’t native Docker for Windows.