Docker Community Forums

Share and learn in the Docker community.

[ask] port opened from Ubuntu with npm Image in Docker for Windows

Hi all,

This is my first post. I am very happy can join this forum.
I am new to Docker and have a problem when I am using it.

OS Version/build: Windows 10 Pro
Docker App version: 1.13.1 (10072)

I installed Docker for Windows 10 and pull Ubuntu image.
Then, I run the image using this instruction: docker run -it ubuntu
Next, I install npm, redis, and other tools that would be used for development.
I commit the image as “npm-ubuntu”

After that, I run npm-ubuntu and bind mount a volume to my source code folder.
I run npm install, npm test, and npm start successfully.
npm start would open port 9000 for localhost (
But, I can’t open in my browser (outside the docker).
I can’t install web browser inside my docker (npm-ubuntu), too.
How to know what ip and the port that I can access from the browser in my laptop outside the docker?
or do you have any suggestion to open from browser (whether inside or outside the docker)?

Thanks in advance.

two solutions:

  • let your docker run with --net=host
  • map your port to outside -p 9000:9000

would prefer the port mapping, cause it’s cleaner.

so you should run
docker run -ti -p 9000:9000 -v your-volume... npm-ubuntu ...

Hi think,

Thanks for the reply.
I have tried both of them and failed.
I think it is because I install npm, etc in Ubuntu by this command: apt-get install npm
What do you think?
Is there any way to make the port that opened by npm on my Ubuntu working successfully?

Thanks in advance.

does docker run -d -p 80:80 --name webserver nginx work?

Otherwise you could try the Examples here step by step. Probably there is still an installation problem.