DEV Community

Cover image for How to use Docker in your Node and React Applications

How to use Docker in your Node and React Applications

Andrew Baisden on June 15, 2022

Docker gives developers the ability to package all of their applications inside of containers. These containers can run on any machine that has Doc...
Collapse
 
ksb86 profile image
kevshabar • Edited

Great article! How do you recommend approaching a similar setup that supports restarting on file changes? Not necessarily a hot reload (although that would be nice too) but just a way to not have to kill and restart the entire container if you need to make an edit to the client or server while running.

Collapse
 
andrewbaisden profile image
Andrew Baisden

Auto reload already works for the React client frontend. I just updated the article with a new section (Optional) Using Nodemon to have the server auto restart when changes occur.

Nodemon will give you the ability to have changes auto update on the backend too!

Collapse
 
ksb86 profile image
kevshabar

👏

Collapse
 
simeg profile image
Simon Egersand 🎈

Quality stuff as always! 🤘

Collapse
 
andrewbaisden profile image
Andrew Baisden

Thanks!

Collapse
 
bishoplee profile image
Olaleye Olalekan Oladipo

Valuable and timely

Collapse
 
ruslanastratov profile image
Ruslan Astratov

Thanks!

Collapse
 
davidsanchez profile image
David N. Sanchez

You wrote a great article. I use docker-compose (poorly) for some Angular and React apps I develop. I had never heard of nodemon and will check that out. I like how clean your build files are.

Collapse
 
yongchanghe profile image
Yongchang He

Thank you for sharing this article!

Collapse
 
suchintan profile image
SUCHINTAN DAS

Thanks Andrew , for sharing this. I was looking for the same thing for my current product 🙂.

Collapse
 
andrewbaisden profile image
Andrew Baisden

Great timing I hope it helps.

Collapse
 
brunoassiscarvalho profile image
Bruno Assis Carvalho

Great!!!

Collapse
 
adhilroshan profile image
Adhil Roshan

Can anyone say, what is the difference it make when we use docker?

Collapse
 
zeffk profile image
Huzaif Qazi

Why are we adding run script in package.json in backend when we have defined CMD [ node app.js ] in dockerfile itself ?

Collapse
 
offline profile image
Offline

Why do you use a higher node version for the client?