DEV Community

Cover image for Dockerize your Development Environment for NodeJS

Dockerize your Development Environment for NodeJS

Jakob Klamser on October 06, 2020

Using Docker in your development workflow has a positive impact on your productivity. It eliminates the typical "It worked on my machine" type of b...
Collapse
 
timo_ernst profile image
Timo Ernst

I love Docker for prod deployments but when using it in dev environments it‘d have to rebuild and re-run the image every time I change something in the code in order to see the result, correct? Any solution to this?

Collapse
 
klamserdev profile image
Jakob Klamser

Actually no, in this example your volume is connected to the container. So every time you change something, for example, in server.js it automatically updates your "localhost".
I recommend trying out this setup ;)

Collapse
 
timo_ernst profile image
Timo Ernst

Oh, I didn’t notice that! That‘s a great way to solve this problem. Thanks, great post! :-)

Collapse
 
vinaysudani profile image
Vinay Sudani

I tried Nodedock (github.com/nodedock/nodedock) Which has some pre configured services, and can be configured further with .env file.

Collapse
 
elonmir profile image
Markus Reisenhofer • Edited

Keep in mind if you use some node tools which normally would run on 127.0.0.1 might need to bind 0.0.0.0 in their respective configs.

Collapse
 
gr3g profile image
Greg Motyl

You have managed to not overcomplicate things and yet explain the topic very well. Great job and thank's!

Collapse
 
klamserdev profile image
Jakob Klamser

Thanks for the awesome feedback

Collapse
 
andrewbaisden profile image
Andrew Baisden

Good introduction into Docker.

Collapse
 
dbarwikowski profile image
Daniel Barwikowski

Nice one! I need to try it :)

Collapse
 
devwhoruns profile image
devwhoruns

If you put the same article as a readme.md in your repos it will be great Jakob.

Collapse
 
klamserdev profile image
Jakob Klamser

Maybe I will do that. Need to think about it