Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
298 views
in Technique[技术] by (71.8m points)

node.js - Can't connect to Node inside Docker container

Hello i created a docker image for a node app :

Dockerfile :

FROM node:10-alpine as build-step
 
WORKDIR /usr/src/app

COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]

RUN npm install 

RUN npm i -g @babel/core @babel/preset-env babel-loader

COPY . .

EXPOSE 5000

CMD ["npm", "start"]

i buil it then i run using this command :

docker run  --publish 5000:5000   nodeApp

it runs normally without errors but when i try to connect to it i can't

my request is : http://127.0.0.1:5000/api/auth/login but i don't have response

result of docker ps

enter image description here

question from:https://stackoverflow.com/questions/66047321/cant-connect-to-node-inside-docker-container

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...