docker容器映射端口不成功
PHPz
PHPz 2017-04-24 09:12:50
0
4
541

我的Dockerfile里暴露的缺失是3000端口,运行下面指令:

docker run -P -d --name myexpress alpha/express

查看结果如下:

可我尝试访问:localhost:32768,没有结果。
但是我登进虚拟机,curl端口3000是有结果的。

所以目前我的情况是:容器内的应用(Express)跑起来了,可外部访问不到,我觉得是端口映射出问题了。
各路大神,给我出出主意吧。

PHPz
PHPz

学习是最好的投资!

reply all(4)
小葫芦

If you want to look at it this way on a mac, there is a container management software called kitematic,

伊谢尔伦

It seems there is a problem with the service binding address. Binding 127.0.0.1 may not receive requests from external IPs.

大家讲道理

127.0.0.1 is a loopback address, which can only be accessed locally and cannot be accessed externally. So your express needs to monitor the address 0.0.0.0

黄舟

-p IP address: host port: IP address: container port/protocol

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!