How to dockerize NodeJS and MongoDB application using docker-compose

In this video we will learn how to use #docker-compose to containerize a #Nodejs #express with #MongoDB as a database.
Chapters:
Introduction 0:00
Description of Example Repo: 0:31
Dockerizing basics: 5:46
Files needed for docker compose: 7:07
Dockerfile for Nodejs application: 9:42
Bonus (npm ci) continuous integration: 12:42
.dockerignore file: 14:16
docker-compose: 16:48
MongoDB container (service): 18:12
Nodejs container (service): 21:57
Volume for MongoDB: 27:31
Starting container (docker compose up): 28:34
Port mapping for Mongodb: 34:24
Developing using #Nodemon: 36:46
Bonus (#Redis container): 41:25
Github link of repo used: github.com/trulymittal/Nodejs...
Install Docker: • Install Docker on Windows
Docker Playlist: • Docker
--------------------------------------------------------------------------
📦FREE $100 credit @Digital Ocean: m.do.co/c/3208f08b3324
--------------------------------------------------------------------------
Subscribe: kzread.info...
--------------------------------------------------------------------------
💵Support the channel:
Paypal: www.paypal.me/trulymittal
Patreon: / trulymittal
--------------------------------------------------------------------------
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for 6 months and I love it! www.kite.com/get-kite/?...
--------------------------------------------------------------------------
======================
✔ Other useful Playlists
======================
#RestAPI (#NodeJS and MongoDB): • REST API using NodeJS ...
#API Authentication using #JWT: • NodeJS API Authenticat...
#Firebase: • Firebase | Build a Not...
Docker: • Docker
MongoDB: • Learn MongoDB in 50 mi...
Html/Css/Js: • HTML / CSS / JS
Android: • Android
Challenges: • Challenges
#yoursTRULY #tutorial #howto #nodejs #android

Пікірлер: 97

  • @leiayuri
    @leiayuri2 жыл бұрын

    Man, Thanks for that. It was really useful. Simple however straight to the important points.

  • @chrisorescan2733
    @chrisorescan27332 жыл бұрын

    This was very thorough. After reading many tutorials about setting up Mongo for docker, this is the only one that actually worked. I'm now looking for more details on initializing Mongo database and roles, but this video has proven very useful.

  • @nomanshahid667
    @nomanshahid667 Жыл бұрын

    I was working on flask (python) restful api with mongodb and none of the flask + docker tutorials I watched had worked. I decided to give this one a go and it worked like a charm. Thank you so much

  • @jonee4468
    @jonee446811 ай бұрын

    Thank you for creating such an informative and easy-to-understand video on Docker. I was confused about its use and how to learn it, but this video cleared up all my doubts. Keep up the great work! 😊

  • @clamgts
    @clamgts2 жыл бұрын

    Thank you, this tutorial was absolutely perfect.

  • @faysalahmed2619
    @faysalahmed26199 ай бұрын

    Thank you man, for providing such a clear and straightforward tutorial

  • @itsivar
    @itsivar Жыл бұрын

    Awesome video, well explained. Thanks!!

  • @narekmusakhanyan523
    @narekmusakhanyan5239 ай бұрын

    You did a great job, thank you!

  • @pasindushavinda4455
    @pasindushavinda4455 Жыл бұрын

    Really Informative Explenation !! Great JOB !! Thank You !! 👏

  • @paragbharadva6018
    @paragbharadva60182 жыл бұрын

    Explored very straight forward.... Loved it.... ❤️

  • @sammed.sankonatti
    @sammed.sankonatti6 ай бұрын

    Crisp and clear explanation ✨. It Solved some of my doubts 🙌

  • @vishal-shinde
    @vishal-shinde10 ай бұрын

    this was a great tutorial. I have my nodejs and mongo project which I wanted to dockerize. thanks!

  • @aram5642
    @aram56422 жыл бұрын

    That is a heck of a good tutorial. I hope you will extend it by migrating api to typescript - then there will be an additional build step.

  • @divisorZero
    @divisorZero6 ай бұрын

    Thank you, Bro! Very informative tutor! It helps me to start!

  • @eL3M3nT4LisT
    @eL3M3nT4LisT8 ай бұрын

    You saved my life with docker and nodejs tech

  • @AjaySharma-vz9ei
    @AjaySharma-vz9ei Жыл бұрын

    Thank you so much for this awesome Content 🙏🏻

  • @sinaukode
    @sinaukode2 жыл бұрын

    Really big thanks to you, how you explain every concept is so nice

  • @mafiacodes

    @mafiacodes

    2 жыл бұрын

    Thanks and welcome Subscribe like share

  • @theprocoder01
    @theprocoder012 жыл бұрын

    Amazing tutorial. The only tutorial which worked for me, many thanks. Keep it up

  • @mafiacodes

    @mafiacodes

    2 жыл бұрын

    Glad to hear that Subscribe like share

  • @shubhamdixit7909
    @shubhamdixit7909 Жыл бұрын

    This is a great one mahn!!

  • @tatianalezhneva9100
    @tatianalezhneva91002 жыл бұрын

    You just saved another 2 hours of my life. Thanks!!!

  • @mafiacodes

    @mafiacodes

    2 жыл бұрын

    Subscribe like share

  • @AminulislamSakib
    @AminulislamSakib Жыл бұрын

    Thank you. It was so helpful

  • @diaaelrahman2410
    @diaaelrahman241017 күн бұрын

    You are the best thank you!

  • @userr4693
    @userr46932 жыл бұрын

    Thank you for making it easy

  • @Asanka-tc3oh
    @Asanka-tc3oh6 ай бұрын

    Thank you very much. very descriptive content

  • @stevenjchang
    @stevenjchang2 жыл бұрын

    WOW, you are SO GOOD at teaching! You really understand the balance of how to give a good pace, while stopping to give explanations when needed. Most coding tutorials don't understand the balance. They either explain every little thing, making the video super slow (and sometimes skipping an important explanation), or they just show a demo of them coding a project and don't explain anything. I felt like you explained everything I wanted to know, and skipped everything I didn't.

  • @tiekkale
    @tiekkale Жыл бұрын

    Excellent Tutorial

  • @andsyahr
    @andsyahr11 ай бұрын

    very nice, it help me a lot

  • @contactpbs2058
    @contactpbs20582 жыл бұрын

    Great conceptual thank you so much sir

  • @paulnaija
    @paulnaija Жыл бұрын

    I was just at 9:54 mins before i subscribed to your channel.... You are very detailed and perfect at teaching... This was very helpful, Thank you.

  • @mafiacodes

    @mafiacodes

    Жыл бұрын

    Welcome aboard!

  • @thongtranlequoc688
    @thongtranlequoc688 Жыл бұрын

    Thank you so much bro! Your video so good!

  • @mafiacodes

    @mafiacodes

    Жыл бұрын

    Glad it helped

  • @TheJavituber
    @TheJavituber11 ай бұрын

    Gracias señor Hindú, me ayudó a salvar el semestre

  • @vishwanathnijampurkar9862
    @vishwanathnijampurkar9862 Жыл бұрын

    great video pls keep making this kind of new videos

  • @subhashgn1775
    @subhashgn1775 Жыл бұрын

    Great tutorial.👌👌

  • @replyishwor
    @replyishwor8 ай бұрын

    thank you brother

  • @ramiworkstation
    @ramiworkstationАй бұрын

    Thank you 🙏

  • @techabl
    @techabl Жыл бұрын

    Great thanks 👍

  • @naveenkumarmurugan1962
    @naveenkumarmurugan196210 ай бұрын

    You are the best

  • @usmanmughal5916
    @usmanmughal59162 жыл бұрын

    Make a video on kurbernetes load balancer with ingress ngnix react,node,database

  • @mirzabicer3896
    @mirzabicer38962 жыл бұрын

    Thank you

  • @arvindnathrajesh255
    @arvindnathrajesh2552 жыл бұрын

    crazy brother. u r god

  • @kiranojha7820
    @kiranojha78202 жыл бұрын

    Amazing tutorial. Can you tell me the theme and font you're using? It's really pleasing for me

  • @be_b_50_ankitkumar_singh79
    @be_b_50_ankitkumar_singh792 жыл бұрын

    Was needed

  • @Cristutz00
    @Cristutz00 Жыл бұрын

    13:20 ci stands for Clean Install

  • @KaioRodrigues-nv9sp
    @KaioRodrigues-nv9sp Жыл бұрын

    Awesome !!11

  • @mafiacodes

    @mafiacodes

    Жыл бұрын

    Subscribe like share 👍

  • @hassanebendaoud4446
    @hassanebendaoud44462 жыл бұрын

    thanks

  • @muhammadmursalin8915
    @muhammadmursalin89152 жыл бұрын

    Great 👍👌

  • @mafiacodes

    @mafiacodes

    2 жыл бұрын

    Subscribe like share

  • @youmee8956
    @youmee89562 жыл бұрын

    Hello sir been waiting for your video so long. But im here just to remind you any plan to release new series of rock solid on how to avoid zero downtime when redeploy the app. don't mind me♥️😊

  • @harshyadav6097
    @harshyadav609711 ай бұрын

    best

  • @jonee4468
    @jonee446811 ай бұрын

    can you please make a tutorial on How to use the same Dockerfile for both local development and production with multi-stage builds?

  • @contactpbs2058
    @contactpbs20582 жыл бұрын

    Please do a video on Microservices Node js

  • @vishwanathnijampurkar9862
    @vishwanathnijampurkar9862 Жыл бұрын

    Please make video on how to manage vulnerability errors

  • @amir-ali8850
    @amir-ali88506 ай бұрын

    could you tell what themes and fonts you are using?

  • @codewithsub5083
    @codewithsub50832 жыл бұрын

    Your VS code configuration looks very good. Can you please share the configuration? Thank you

  • @mafiacodes

    @mafiacodes

    Жыл бұрын

    Yes I can

  • @codewithsub5083

    @codewithsub5083

    Жыл бұрын

    @@mafiacodes please share a gist. Thank you 🤩🤩

  • @AbdulAlim-zg8vt
    @AbdulAlim-zg8vt2 жыл бұрын

    Can you please share the example files?

  • @webcoder293
    @webcoder29311 ай бұрын

    If I have already a db in Mongodb atlas and I wanna use it inside container, then what would be the Mongo env variables. And where to mention that - docker-compose.yml or Dockerfile?

  • @ahmedhafez9951
    @ahmedhafez995111 ай бұрын

    ♥♥♥

  • @md.abuhusna9666
    @md.abuhusna9666 Жыл бұрын

    Would you please share the font family name you are using ?

  • @markopavlovic6066
    @markopavlovic6066 Жыл бұрын

    Hello, i want my mongodb container to use data from local db how can i do that?

  • @Templestepscom
    @Templestepscom9 ай бұрын

    npm ci - ci stand for clean install

  • @riteshthakur9250
    @riteshthakur92502 жыл бұрын

    Hii I am building a microservice in docker-compose and i want that if any service crashes then it should restart automatically. i used restart tag in compose file but it is not restarting if the service crashes. All of my services in node app. Can you please help me.

  • @mufeezahmedmohammad9441
    @mufeezahmedmohammad94412 жыл бұрын

    Wow

  • @mafiacodes

    @mafiacodes

    2 жыл бұрын

    Subscribe like share

  • @swejalshrestha4744
    @swejalshrestha47442 жыл бұрын

    after docker compose up... my node server is working but there is problem in database connection

  • @VarunDeva23
    @VarunDeva232 жыл бұрын

    How to backup MongoDb database? For time being i want to backup my MongoDb data to my local pc from my Vps server which is digital Ocean droplet. After some time I'll create new droplet and restore the database. If it's the mysql then i can download .sql file from exporting Through phpmyadmin. Whenever i want i can import .sql file again Same thing how to do with docker? For MongoDb

  • @yosepmys7605
    @yosepmys76052 жыл бұрын

    Thank you for your tutorial. I following yours, but I’m stuck with 404 status when I access localhost:4000. While status in terminal: nodejs-rest-api-api-1 | Mongodb connected.... What should I do to find where error(s) came from? TIA.

  • @yosepmys7605

    @yosepmys7605

    2 жыл бұрын

    So I clone the code from git, and there was different in app.js route. After I add get(‘/‘) it works! But why nodemon not working with yours? I add volumes to include node_modules and it works.

  • @user-ek1sj4dp2k
    @user-ek1sj4dp2k10 ай бұрын

    If my database is in mongodb atlas, then what different steps should i follow......( like you changed localhost name to mongodb , so i am asking)

  • @srinuannamneedi6458
    @srinuannamneedi64582 жыл бұрын

    I have cloned the repo and followed the steps as u mentioned , but getting this error " Mongoose connection is disconnected..."

  • @vishalmishra1937
    @vishalmishra193714 минут бұрын

    throwing authentication error in mongosh

  • @mahitoshgiri5879
    @mahitoshgiri587927 күн бұрын

    😊

  • @digvijaysinghthakur2903
    @digvijaysinghthakur29032 жыл бұрын

    Can we add Mongodb Atlas URI in place of local MONGODB_URI in api service inside docker-compose but in that case I think we don't need mongodb service because now our database hosted on cloud. Am I right?

  • @mafiacodes

    @mafiacodes

    2 жыл бұрын

    Yes 💯%

  • @abhiramsatpute

    @abhiramsatpute

    Жыл бұрын

    @@mafiacodes if possible PIN this comment as well, this doubt will come to many

  • @vinosamari

    @vinosamari

    Жыл бұрын

    @@abhiramsatpute There are still use cases for running locally so having the atlas url doesn't invalidate this method.

  • @kostaskaldis9285
    @kostaskaldis92852 жыл бұрын

    nodemon part is not working for my case

  • @milon27
    @milon272 жыл бұрын

    please make a part 2 of it. deploy it on digital ocean Ubuntu server

  • @milon27

    @milon27

    2 жыл бұрын

    part 3: show ci/cd using GitHub action

  • @randrianantenainanambinint9686
    @randrianantenainanambinint96864 ай бұрын

    Good content but i have problem, when i consult my api logs, i have that: > NODE_ENV=DEVELOPMENT nodemon app.js sh: nodemon: Permission denied

  • @lukachannel12
    @lukachannel122 жыл бұрын

    I followed the tutorial, however when I do "docker compose up", it gives me an error "MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". It's like the environment varaiables I declared aren't being read properly. I'm using an .env file and it works fine when I run the app outside of a container. I searched online and found no solution. Any tips? Great video btw, helped me a lot, thanks!

  • @OneEyedGhost

    @OneEyedGhost

    2 жыл бұрын

    Hey I am also doing the same and got the error before i added the env variables in the dockerfile. Hope it helps!!

  • @kiranojha8811

    @kiranojha8811

    2 жыл бұрын

    you need to add env inside docker compose

  • @suryavamsi5031
    @suryavamsi5031 Жыл бұрын

    Server started on port 3000... nodejs-rest-api-nodejs-1 | Mongoose connection is disconnected... nodejs-rest-api-nodejs-1 | Server selection timed out after 30000 ms nodejs-rest-api-nodejs-1 | Server selection timed out after 30000 ms, I'm getting this error, could any help me out...

  • @rbnby
    @rbnby2 жыл бұрын

    I miss your android tutorial

  • @sanitbandekar

    @sanitbandekar

    2 жыл бұрын

    me too

  • @jinnybat
    @jinnybat Жыл бұрын

    I cannot connect to mongoDb with db name or container name however it is getting created and connected with localhost only, am I missing something?

  • @user-zz6du6ri9k

    @user-zz6du6ri9k

    11 ай бұрын

    I am facing the same issue now. Did you fins a solution?

  • @changqing8901

    @changqing8901

    9 ай бұрын

    Me too

  • @user-gi9oj9iz5r
    @user-gi9oj9iz5r Жыл бұрын

    For anyone getting an error 404 not found, add this above the const productRoute.... (it's not on the githubrepo) app.get('/', (req, res, next) => { res.json({ message:'It works .', env_name: process.env.NAME}) })

Келесі