Docker Community Forums

Share and learn in the Docker community.

Cannot reach node.js server from windows

Hello. I have the following Dockerfile:

# Set the base image to Ubuntu
FROM    ubuntu:yakkety
# File Author / Maintainer
MAINTAINER Phil
# Install Node.js and other dependencies
RUN apt-get update
# The -y flag is automatic "yes" reply because the response to this command is a question and not null
RUN apt-get -y install curl
# the setup_7.x specifies the version of node to be pulled from github
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash
RUN apt-get install nodejs
# Create app directories
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package.json /usr/src/app/
RUN npm install
# Bundle app source
COPY . /usr/src/app
# Expose port
EXPOSE 8080
# Run app using nodemon
CMD ["npm", "start"]

When I build the container using

docker build -t my_image .

and then start the ubuntu container with

docker run --interactive --tty my_image /bin/bash

and the app with

node server.js

I get the console log that the server is running, but I cannot contact said server on http://localhost:8080/ in any of my windows browsers. As you can see port 8080 is exposed, so what might be the problem?