0

install docker toolbox in win7 64bit

my code:

docker run --name web -d -p 8000:8000 richarvey/nginx-php-fpm 

I can't see any result in chrome browser.

reinstall docker toolbox && reboot && disable firewall did not help.

192.168.99.100:8000
172.17.0.2:8000
localhost:8000

docker inspect web | grep IPAddress 

show:

 "SecondaryIPAddresses": null, "IPAddress": "172.17.0.2", "IPAddress": "172.17.0.2", 

run:

$ docker-machine ls 

show:

NAME ACTIVE DRIVER STATE URL SWARM DO CKER ERRORS default * virtualbox Running tcp://192.168.99.100:2376 v1 8.06.1-ce 

run:

$ docker ps 

show:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 65b815ffa17c richarvey/nginx-php-fpm "docker-php-entrypoi" 4 hours ag o Up 4 hours 80/tcp, 443/tcp, 9000/tcp, 0.0.0.0:8000->8000/tcp web 

enter image description here


update

docker run --name web -d -p 8000:80 richarvey/nginx-php-fpm 

http://192.168.99.100:8000/ <-- only this one work!
http://172.17.0.2:8000/
http://localhost:8000/

Inside docker,

  1. first off check if nginx is running.

  2. see which process is using port 80


bash-4.4# ps aux | grep nginx 14 root 0:00 nginx: master process /usr/sbin/nginx -g daemon off; error_ log /dev/stderr info; 15 nginx 0:00 nginx: worker process 16 nginx 0:00 php-fpm: pool www 17 nginx 0:00 php-fpm: pool www 18 nginx 0:00 php-fpm: pool www 29 root 0:00 grep nginx bash-4.4# netstat -tulpn | grep :80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 14/stderr info; tcp 0 0 :::80 :::* LISTEN 14/stderr info; bash-4.4# 

1 Answer 1

1

The image you use publishes NGinx port at its port 80. So, if you want it at your public port 8000, you should run the container with:

docker run --name web -d -p 8000:80 richarvey/nginx-php-fpm 

Edit: Alternatively (only with Docker on Linux), you can access to container's private IP (taken from docker inspect web) at port 80 with your browser: http://172.17.0.2

Sign up to request clarification or add additional context in comments.

2 Comments

I think the Docker-internal IP addresses are unreachable if you're using Docker Toolbox. They're unreachable in a lot of interesting cases and you should avoid looking for or using them. You need the docker-machine ip address, usually 192.168.99.100, as the "host".
only docker-machine ip (192.168.99.100) work. docker inspect conainter-id | grep IPAddress (172.17.0.2) (Docker-internal IP?) doesn't work.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.