Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker image NGINX not exposing : site cannot be reached

Tags:

docker

nginx

1. I was using this guide to get a nginx webserver image to run and used the commands

docker run -p 8888:80 nginx

docker run -p 80:80 nginx

I guess two or more containers got up and running but when I open localhost:8888 it shows the site cannot be reached.

I have also used this to try and expose something on my browser. It showed the same problem too.

2. One more question, when I run more containers with the same image file, the terminal shows nothing as console and doesn't even terminate i.e, return to the the dollar sign . So I would be stuck and forced to open another terminal. Is there some trick concept I'm missing here.

Please note I have installed docker on windows and used docker quick start terminal for the above.

like image 501
Codex Avatar asked Jul 18 '16 08:07

Codex


2 Answers

The problem was that I was running it on VM on windows which happens with docker .

So in one of the beginner tutorials it was mentioned that the port is forwarded to this VM port not on the windows port. (Just read the note below the hello world! browser image)

So you have to find the ip address of your VM OS and paste it in the browser along with the port number.

like image 139
Codex Avatar answered Nov 08 '22 17:11

Codex


For me in Windows instead of pointing to localhost i used the resulted ip of running the command:

docker-machine ip default
like image 6
J.J Avatar answered Nov 08 '22 18:11

J.J