简体   繁体   中英

Can't access docker port from remote

I start a container on machine whose IP address is 47.foo.bar.bazz :

docker run -it -p 8888:8888 continuumio/miniconda3

And inside the container , 8888 port is opened by a flask application:

python manage.py runserver -h 0.0.0.0 -p 8888

I can send http request to this port successfully by

curl "http://127.0.0.1:8888/api/v1/vocabulary?callback=zoo

But when I use it's IP it doesn't work, and I can't access it from remote machine either

curl "http://47.foo.bar.bazz:8888/api/v1/vocabulary?callback=zoo

Here is some information:

netstat -aptn
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name  
tcp6       0      0 :::80                   :::*                    LISTEN      9211/docker-proxy   
tcp6       0      0 :::8888                 :::*                    LISTEN      28811/docker-proxy  
tcp6       0      0 :::443                  :::*                    LISTEN      9194/docker-proxy  

Btw,I can curl the 80 port successfully using the IP address.

Could anyone please point out what's wrong?How can I access it successfully from remote machine?

I figured out here. Maybe the port is blocked. On the other hand,I used nginx to forward my request form 80 to 8888.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM