Docker Community Forums

Share and learn in the Docker community.

Cannot map port for Docker

(Ngoctuan001) #1

Hi guys,
I’m using Docker toolbox for Windows 7 and following the tutorial:
I am able to create image and push it to my dockerhub.
However , when i run docker using command:
docker run -d -p 4000:80 friendlyhello
Its shows no error. however , when i direct to http://localhost:4000.
It say This site can’t be reached ( no result ).
Any help please

UPDATE : Although i cannot acces localhost:4000 . I can access and get my desired result . Anybody know the reason why ???

(Michael Friis) #2

Yes, that’s how Docker Toolbox works:

(Joao Fernandes) #3

Just to give a bit more detail, when you install Docker Toolbox, you’re actually running a virtual machine that is running Docker. That means that your app is being exposed on port 4000 of that virtual machine.

So you need to use the ip address of the machine to access the service, since Docker is not running natively in your machine.