- Assuming you have already installed npm, in the folder where package.json is located, do
npm install
-
In the folder with Dockerfile do
sudo docker build -t my-app:1.0 .
-
Make sure there were no errors and you have both images(node and my-app), do
sudo docker images
-
In the folder with docker-compose.yaml do
sudo docker-compose -f docker-compose.yaml up
-
Wait for everything to download
-
Try to access both the app and the database - open a browser and type localhost:8080 and localhost:3000
-
Try editing and saving any info at localhost:3000 and then check if MongoDB created new volume and saved edited info
-
If you don't see MongoDB create a new volume, try sudo docker-compose -f docker-compose.yaml restart
-
This site can’t be reached when connecting to localhost:3000, make sure you did
npm install
and have node_modules folder within the app folder