我的Dockerfile里暴露的缺失是3000端口,运行下面指令:
docker run -P -d --name myexpress alpha/express
查看结果如下:
可我尝试访问:localhost:32768,没有结果。但是我登进虚拟机,curl端口3000是有结果的。
所以目前我的情况是:容器内的应用(Express)跑起来了,可外部访问不到,我觉得是端口映射出问题了。各路大神,给我出出主意吧。
学习是最好的投资!
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
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