Unable to access localhost:3000

Hello,

Docker beginner here

Used following dockerfile to create the image.

Dockerfile:

From node:latest

ENV MONGO_INITDB_ROOT_USERNAME=admin
MONGO_DB_PWD=password

RUN mkdir -p /home/app

COPY ./app /home/app

set default dir so that next commands executes in /home/app dir

WORKDIR /home/app

RUN npm install

CMD [“node”,“server.js”]

============================================

Once the container is created and run it i get this message

$ docker run da8bd411d2d1
(node:1) Warning: Accessing non-existent property ‘count’ of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:1) Warning: Accessing non-existent property ‘findOne’ of module exports inside circular dependency
(node:1) Warning: Accessing non-existent property ‘remove’ of module exports inside circular dependency
(node:1) Warning: Accessing non-existent property ‘updateOne’ of module exports inside circular dependency
app listening on port 3000!

But when i try to access this webpage using localhost:3000 it says this page cannot be reached.

This site can’t be reached

localhost refused to connect.
Try:

ERR_CONNECTION_REFUSED

Not sure what I am doing wrong. Please advise.

Please format your post according this post: How to format your forum posts

How do you start the container? You need to export the port you want to connect to with -p or ports. (Doc)