更新时间:2023-10-16 10:31:16
好的,正如您在问题中所说,您的进程正在侦听 localhost:4200
上的连接.
Ok, as you say in your question, your process is listening to connection on localhost:4200
.
在一个docker容器内,localhost
是容器本身的loopback设备的地址,与你的宿主网络是分开的,无法访问的.
Inside a docker container, localhost
is the address of the loopback device of the container itself, which is separated and not reachable from your host network.
您需要编辑您的节点进程,以便通过编辑 Dockerfile 中的入口点使其监听所有地址,如下所示:
You need to edit your node process in order to make it listen to all addresses by editing the entrypoint in your Dockerfile as follows:
ENTRYPOINT ["ng", "serve", "-H", "0.0.0.0"]