Home > Enterprise >  Docker image cannot connect on localhost
Docker image cannot connect on localhost

Time:10-06

I am using this Dockerfile to create an image and start a container:

FROM node:6.1.0-wheezy 
RUN mkdir /usr/src/goof
COPY . /usr/src/goof
WORKDIR /usr/src/goof

RUN npm install
EXPOSE 3112
EXPOSE 31337
CMD ["npm", "start"]

So the image was created and also the container started but when I try to access it using localhost:3112 is not working.
Does anybody know what could be the problem ?

This is the code structure: enter image description here

and this is the command how I start the container docker run --rm -p 3112:3112 --name rce rce

CodePudding user response:

As you mention in the comments it looks that you expose the wrong port for your node app

so all you need is to expose port 3113 for your app and when you run your container will be something like this

docker run --rm -p 3113:3113 -p 3112:3112 --name rce rce
  • Related