我的Dockerfile里暴露的缺失是3000端口,運(yùn)行下面指令:
docker run -P -d --name myexpress alpha/express
查看結(jié)果如下:
可我嘗試訪問:localhost:32768,沒有結(jié)果。
但是我登進(jìn)虛擬機(jī),curl端口3000是有結(jié)果的。
所以目前我的情況是:容器內(nèi)的應(yīng)用(Express)跑起來了,可外部訪問不到,我覺得是端口映射出問題了。
各路大神,給我出出主意吧。
學(xué)習(xí)是最好的投資!
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