# Use Docker to Create a Node Development Environment

**URL:** <https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800>\
**Category:** Blog Discussions\
**Created:** [February 26, 2019, 3:02pm UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800 "2019-02-26T15:02:08Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramiro](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ramiro/32/8077_2.png) [@ramiro](https://community.auth0.com/u/ramiro)\
**Post date:** [February 26, 2019, 3:02pm UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/1 "2019-02-26T15:02:08Z")

</div>

Leverage Docker images and containers to create an isolated Node development environment that runs a server.

Read on \>\> [Use Docker to Create a Node Development Environment](https://auth0.com/blog/use-docker-to-create-a-node-development-environment)

 ![Use%20Docker%20to%20Create%20a%20Node%20Development%20Environment](https://global.discourse-cdn.com/auth0/original/2X/b/bd8adbf4546df0a1eaad8d13eb023739d8565ce0.png)

---

<div class="post-metadata">

**Author:** ![unclejustin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/unclejustin/32/11468_2.png) [@unclejustin](https://community.auth0.com/u/unclejustin)\
**Post date:** [March 2, 2019, 6:41pm UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/2 "2019-03-02T18:41:12Z")

</div>

So this doesn’t work for me when I use `docker-compose run`, but does work when I use `docker run`. When using docker-compose I always get “Site can’t be reached”.

---

<div class="post-metadata">

**Author:** ![pspierce](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pspierce/32/11470_2.png) [@pspierce](https://community.auth0.com/u/pspierce)\
**Post date:** [March 2, 2019, 7:58pm UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/3 "2019-03-02T19:58:33Z")

</div>

You have to use “–service-ports” with “docker-compose run …” Otherwise, the ports aren’t exposed and mapped. This post should be edited to reflect that fact.

---

<div class="post-metadata">

**Author:** ![unclejustin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/unclejustin/32/11468_2.png) [@unclejustin](https://community.auth0.com/u/unclejustin)\
**Post date:** [March 3, 2019, 2:55am UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/4 "2019-03-03T02:55:46Z")

</div>

Yep that fixed it. Thanks!

---

<div class="post-metadata">

**Author:** ![dan-auth0](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dan-auth0](https://community.auth0.com/u/dan-auth0)\
**Post date:** [March 7, 2019, 5:55pm UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/5 "2019-03-07T17:55:38Z")

</div>

Great catch! That was on oversight on my part. Thank you for helping out @unclejustin 😀 I was out sick these past days.  
.  
I will be updating the post right away 🙂

---

<div class="post-metadata">

**Author:** ![jzamor](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jzamor/32/11925_2.png) [@jzamor](https://community.auth0.com/u/jzamor)\
**Post date:** [March 21, 2019, 5:01am UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/6 "2019-03-21T05:01:02Z")

</div>

Do you have any developers using Windows? Concurrent file access with host mounted volumes appears to be a problem experienced in Docker for Windows: [Files are randomly not found in shared folder when using Win10 host and Linux container · Issue #969 · docker/for-win · GitHub](https://github.com/docker/for-win/issues/969)

---

<div class="post-metadata">

**Author:** ![dan-auth0](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dan-auth0](https://community.auth0.com/u/dan-auth0)\
**Post date:** [March 22, 2019, 2:51pm UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/7 "2019-03-22T14:51:52Z")

</div>

@jzamor Thank you for bringing up this concern! I am currently in the process of researching Docker in a Windows environment and also Windows Containers. I am waiting for a few resources to line up to be able to provision a native Windows OS 🙏 Please stay tuned and thank you for reading 💪

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 30, 2019, 12:46pm UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/8 "2019-08-30T12:46:18Z")

</div>



---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [September 5, 2019, 4:02pm UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/9 "2019-09-05T16:02:58Z")

</div>



---

<div class="post-metadata">

**Author:** ![jackfusion](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jackfusion/32/25640_2.png) [@jackfusion](https://community.auth0.com/u/jackfusion)\
**Post date:** [November 16, 2020, 8:10pm UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/10 "2020-11-16T20:10:52Z")

</div>

When I run the container we docker-compose it keeps restarting. when I run docker logs node (name of container) there is no logs. Not sure what I am doing wrong here can you help please?  
Everything work perfect with the dockerrun command  
docker run --rm -it --name node-docker   
-v $PWD:/home/app -w /home/app   
-e “PORT=3000” -p 8080:3000   
-u node node:latest /bin/bash

Dockerfile in node folder  
FROM node:latest  
WORKDIR /home/app  
USER node  
ENV PORT 3000  
EXPOSE 3000  
ENTRYPOINT /bin/bash

dockercompose  
version: ‘3.7’  
services:  
node:  
build: node/  
hostname: node  
container\_name: node  
restart: always  
ports:  
- 9005:3000  
volumes:  
- ${USERDIR}/node:/home/app  
I have a .env file created for the ${USERDIR} pointing to /srv/dev-disk-by-label-media/server/config/LEMP

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 10, 2021, 9:25am UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/11 "2021-12-10T09:25:06Z")

</div>



---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [March 7, 2022, 2:08pm UTC](https://community.auth0.com/t/use-docker-to-create-a-node-development-environment/21800/12 "2022-03-07T14:08:28Z")

</div>


