Dockerized Aurelia App Is Not Visible Outside of Docker Container - Not listening on 0.0.0.0

自古美人都是妖i 提交于 2019-12-25 01:17:43

问题


I'm running an Aurelia app inside of the standard node docker container and it is listening on port 8080. Within the container, I have tested that it's running using curl; and it responds with the expected HTML. But I cannot reach the app via the mapped port on the host (outside the container).

I'm running the following command to start the container

$ docker run -it --rm -p 8080:8080 -v ${PWD}:/app node bash

Then inside the container, I install the cli and create a new app

# npm install -g aurelia-cli
# au new

After creating a default app, I cd into the app directory and run the app.

# au run

As I said above, I can verify the app is running using curl http://localhost:8080. However, on the host, I cannot access the app:

$ curl http://localhost:8888
curl: (52) Empty reply from server

Originally, I thought this was a docker problem. See this question. But it turns out that Aurelia is listening on localhost rather than 0.0.0.0.


回答1:


Running Aurelia with the host option set allows the server to listen on 0.0.0.0, so it will map properly in a docker container.

au run --host 0.0.0.0 


来源:https://stackoverflow.com/questions/58685078/dockerized-aurelia-app-is-not-visible-outside-of-docker-container-not-listenin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!