I have a nodejs application. It runs in a container. I need to forward ports to the host machine. I ask for your help.
Dockerfile:
FROM node:14
WORKDIR /usr/src/app
COPY . .
RUN yarn
EXPOSE 4200
try:
docker run -p 127.0.0.1:4200:4200 -t -d --name vub vub
# or
docker run -p 4200:4200 -t -d --name vub vub
My application is running on port 4200. The operation of the application can be checked through
curl http://localhost:4200/
In the container, the application works correctly.
Why can't I see the application on the host machine(http://localhost:4200/)? How to fix it?
question from:
https://stackoverflow.com/questions/65846526/dockerfile-how-to-forward-ports 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…