Docker Compose in 6 minutes! Mongo, Express, React, Node (MERN) Application Tutorial

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 27. 07. 2024
  • If you are using Docker and your application consists of multiple services, you need to be using docker-compose!
    In this video, I walk through a full example of how to configure docker-compose for a MERN (Mongo, Express, React, and Node.js) application explaining each configuration option along the way.
    The application shown is based on this post: / how-to-create-your-fir...
    Full code can be found here:
    github.com/sidpalas/devops-di...
    Cheers!
    ---
    Join the Community:
    💬 Discord: / discord
    đŸ’» GitHub: github.com/sidpalas/devops-di...
    đŸ„ Twitter: / sidpalas
    đŸ‘šâ€đŸ’Œ LinkedIn: / sid-palas
    🌐 Website: devopsdirective.com
    ---
    Timestamps:
    0:00 - Intro
    0:40 - Why do we need Docker Compose?
    1:42 - MERN sample app
    2:17 - Building react-app and api-server Docker images
    2:33 - docker-compose.yml walkthrough
    3:38 - Network discoverability
    4:09 - Non-default network
    4:34 - Data volume
    4:50 - App demo
    ---
    Community Size at Time of Posting:
    - Subscribers: 442
    - Channel Views: 6896
    Note: I have a running joke with my wife that I'm not going to shave my beard until I reach 1000 subscribers (the last time I did was at 100...) and it is starting to get out of control 🧔+🎅+😳+😬
  • Věda a technologie

Komentáƙe • 242

  • @Dan-codes
    @Dan-codes Pƙed 2 lety +1

    I love the pace that you work through things, no filler and everything I need as a devops newb.

  • @pojomcbooty
    @pojomcbooty Pƙed 3 lety +12

    The clarity !! All tutorials should be like this. From split-screening, to having individual lines of code appear rather than each character, thus is just so clear to my brain!! Bug kudos ! Subscribing

  • @andji8709
    @andji8709 Pƙed 2 lety +1

    Amazing video! You explained everything in a very understandable and clear way without oversimplyfing it. Love it

  • @bulelanibotman
    @bulelanibotman Pƙed 2 lety

    what an informative video, i don't know much about docker but i was able to understand what docker compose does in just a few minutes into the video. you add yourself a subscriber

  • @Rodrigo-lq2iy
    @Rodrigo-lq2iy Pƙed 3 lety +2

    It's amazing, i feel i learnt way more than 6 minutes. Totally subscribing and recommending this channel! Thank you very much!!

  • @renzzogomez2134
    @renzzogomez2134 Pƙed rokem

    Thanks a lot mate, I was needing this for a project, great job, please keep rocking!!!

  • @Gwittdog
    @Gwittdog Pƙed 24 dny

    This video is freaking brilliant. High level yet concise. You have my bell icon being rang.

  • @mainulislamfaruqi
    @mainulislamfaruqi Pƙed 2 lety

    We have to give a comment for appreciation such an amazing content. So organized, easy to understand.

  • @shivangitomar5557
    @shivangitomar5557 Pƙed 2 lety +1

    I finally understood after watching 10 other videos! You are amazing!!

  • @BulletSP
    @BulletSP Pƙed 5 měsĂ­ci

    thanks man for saving our time, u explained it very crisp and concise and fully comprehensible

  • @markay_
    @markay_ Pƙed 3 lety

    this is awesome stuff! was able to build my frontend and backend images and execute them with docker-compose. thx!

  • @jamessteph9088
    @jamessteph9088 Pƙed rokem

    Wow!! Great content. simple and well explained. Thank you so much.

  • @rodrigolustosa9090
    @rodrigolustosa9090 Pƙed 3 lety

    Damn!! i'm not even a speaker of your language, and still got the whole ideia.Nice vĂ­deo my friend, you earned a new subscriber!! Hope now i'm going to be able to absorb this whole docker thing

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      Amazing! Welcome to the team! 👋👋👋
      I have a few other Docker videos as well if you want to check those out.

  • @conandev3710
    @conandev3710 Pƙed 2 lety

    Well-made, high-quality video. Subscribed. Well done!

  • @marjie9288
    @marjie9288 Pƙed 3 lety

    This just one video it solves all my problems on MERN. You are a God sent to us. I'm from the Philippines.

  • @chiefterribleteacher8687
    @chiefterribleteacher8687 Pƙed 3 lety +1

    Concise and super helpful, thanks for sharing!

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      Thanks @Chief Terrible Teacher! I'm planning to do a follow up soon where I take the same setup and make some tweaks to make it more suitable for deployment (since this video shows a development configuration)
      Stay tuned!

  • @sureshkrishnan83
    @sureshkrishnan83 Pƙed 3 lety +2

    I probably end up watch all your video by end of this weekend . 😀..thanks

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +3

      Epic!
      Depending on which order you watch, you will see the production quality going âŹ†ïž or âŹ‡ïž and my beard growing or shrinking 🧔

  • @chiragkhachane9739
    @chiragkhachane9739 Pƙed 3 lety +1

    Hey man this video was just the thing I was looking for. Solved some of my queries to! Thanks for the tutorial.

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      Awesome! Are you building something with docker compose?

    • @chiragkhachane9739
      @chiragkhachane9739 Pƙed 3 lety +1

      @@DevOpsDirective Yeah. I am building my Undergraduate Project with Docker and MERN stack.

  • @nuwan9266
    @nuwan9266 Pƙed 2 lety

    Superb. Everything you explained is pretty clear!

  • @Gamer8308
    @Gamer8308 Pƙed 3 lety

    Really loved the video !! Helped me a lot thanks !

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      Amazing -- thanks for watching and for letting me know!

  • @linocesar6328
    @linocesar6328 Pƙed 3 lety

    thanks for the video, I'm starting to get to know this technology, and I find it super useful, I want to use it with the MERN stack.

  • @Abel_Lopez_
    @Abel_Lopez_ Pƙed 3 lety

    Awesome! Amazing explanation, thank you!

  • @miladjamali6289
    @miladjamali6289 Pƙed rokem

    nice and clear toturial by the way thank you

  • @PeterFullen
    @PeterFullen Pƙed 2 lety

    Really great concise video

  • @LeviAckerman-pl9um
    @LeviAckerman-pl9um Pƙed 3 lety +1

    Short informative and simple, thank you for sharing. here's a sub

  • @sriraghariharan130
    @sriraghariharan130 Pƙed 2 měsĂ­ci

    Short and knowledge heavy ❀

  • @KieCodes
    @KieCodes Pƙed 3 lety

    Wow, amazing video, and congratulations on 500 subs! 🙏

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      Thanks Kie -- trying to keep up with you! 😎

    • @KieCodes
      @KieCodes Pƙed 3 lety

      @@DevOpsDirective Man, you surpass me easily! My upload schedule is a mess right now. :D

  • @mohammadsaad4419
    @mohammadsaad4419 Pƙed 3 lety

    this is one great video man, keep it up.

  • @MJ-ih1yu
    @MJ-ih1yu Pƙed 3 lety +1

    Great explanation! Keep teaching👌

  • @harrisonfok8267
    @harrisonfok8267 Pƙed rokem

    Wow this is really helpful!

  • @jonasex3001
    @jonasex3001 Pƙed 2 lety

    Awesome I'm loving your videos! Thanks!

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 2 lety +1

      Great -- Thanks for letting me know! Comments like this make it worth the effort!

  • @chiraggarg8012
    @chiraggarg8012 Pƙed 3 lety

    Thanks. This tutorial clarified my mistakes. Amazing Video

  • @TuomoKankaanpaa
    @TuomoKankaanpaa Pƙed 3 lety

    Nice video! 👍 Im using docker compose daily to spin up my dev environment that includes e.g. node, postgres, redis and react.

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      It's a game changer, isn't it? Up and running with a single command!

    • @TuomoKankaanpaa
      @TuomoKankaanpaa Pƙed 3 lety

      @@DevOpsDirective Yea for sure, fast and easy!

  • @hafizsabihulhassan1905
    @hafizsabihulhassan1905 Pƙed 3 lety

    Very simple precise and perfect you are awesome brother

  • @externemw3
    @externemw3 Pƙed 3 lety

    Thank you! Awesome! Greetings from Brazil :)

  • @edu_sdorneles
    @edu_sdorneles Pƙed rokem

    What a great video!!!

  • @ayoubmanar9205
    @ayoubmanar9205 Pƙed rokem

    MAN YOU ARE TOO MUCH GOOD

  • @darwish-mammo
    @darwish-mammo Pƙed 3 lety

    you're a great guy mate! thanks for the video

  • @Gacu700
    @Gacu700 Pƙed 3 lety

    THIS MOVIE ACTUALLLY WORKS! Tahnk you very much, now i get it :D

  • @pedruchu259
    @pedruchu259 Pƙed 3 lety +1

    You are a God, thanks so much, you saved my life!

  • @MjCarnaje-jd5ut
    @MjCarnaje-jd5ut Pƙed 2 lety

    THANK YOUU!! very understandable!

  • @girlsincode9255
    @girlsincode9255 Pƙed 3 lety

    simple and clear.great !!!

  • @consoledoterror971
    @consoledoterror971 Pƙed 3 lety

    "Just keep building"
    Subbed. Thanks

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      It's the only way to get better! Welcome to the team!

  • @ced4841
    @ced4841 Pƙed 3 lety +1

    Good Video, pleasant voice!

  • @BDominikGT
    @BDominikGT Pƙed 3 lety

    Perfect!!!
    Thank you very much.

  • @HoaLe-jx3gg
    @HoaLe-jx3gg Pƙed 3 lety

    Very useful!

  • @anamariasanchez6088
    @anamariasanchez6088 Pƙed 3 lety

    Excellent!!thank!

  • @ssaai
    @ssaai Pƙed 2 lety

    Excellent đŸ‘đŸ»đŸ‘đŸ»đŸ‘đŸ»đŸ‘đŸ»đŸ‘đŸ»đŸ‘đŸ»đŸ‘đŸ»

  • @ousmanevincentdione9369
    @ousmanevincentdione9369 Pƙed 3 lety

    Very helpful!! You are amazing!! very nice explanation! Thank you so much!! You fix my comprehension in just 6 minutes!! Can you make a tutorial with java ee wildfly postgres and angular please.

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      Thank you for the kind words!
      I have minimal experience w/ Java and Angular, so I'm probably not the best person to make a tutorial like that.

    • @ousmanevincentdione9369
      @ousmanevincentdione9369 Pƙed 3 lety

      @@DevOpsDirectiveOk. i understand.Thank you so much !!!

  • @antoniomagalhaes9812
    @antoniomagalhaes9812 Pƙed 2 lety

    Great content, thank you.

  • @thear0a
    @thear0a Pƙed 2 lety

    thanks, short and to the point

  • @MuhammadBilal-cq6tp
    @MuhammadBilal-cq6tp Pƙed 2 lety

    Good Content.

  • @kumarv1374
    @kumarv1374 Pƙed rokem

    After changing the mondb url from localhost to mongo where I can see it in mongodb compass because iam not able see the data stored after changing it to mongo

  • @meshavegas
    @meshavegas Pƙed 6 měsĂ­ci

    I have a question if instead of using the network I use nginx is a correct practice?

  • @farzadsole3784
    @farzadsole3784 Pƙed 3 lety +2

    Excellent video, however I had to add the following 2 lines under docker-compose file to get things working;
    Under "react-app:"
    add > build: ./client
    Same for "api-server:"
    add > build: ./server
    Thanks

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +2

      Thanks @Farzad!
      I build the images separately (before running docker-compose up) which is why I was able to use just the "image" name in the docker compose file!

  • @luppo2007
    @luppo2007 Pƙed 3 lety

    nice video sir! i love it, i have one question im getting started with this docker compose thing. how i create an docker image " of all " to upload to my docker hub? i mean i dont want to create an image of my server side, another of my client and pull the mongo one. it is possible to create one only image and pull it all and run?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      Hi @luppo2007 -- while you technically could run them all in a single container by adding a custom startup.sh script (or similar) to start the 3 processes is is generally a bad idea.
      There are a number of reasons for this, explained here: devops.stackexchange.com/questions/447/why-it-is-recommended-to-run-only-one-process-in-a-container

  • @Levelord92
    @Levelord92 Pƙed 3 lety

    You had 440 subscribers, now you have almost 9 thousand. Congrats!
    What if I need to specify username:password for images like Mongo/RabbitMQ?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      Thanks @Levelord!
      You would likely want to specify them as an environment variable. In this video, I show one method of doing this: czcams.com/video/DftsReyhz2Q/video.html
      You can do this in the docker run command or with docker-compose (docs.docker.com/compose/environment-variables/#the-env_file-configuration-option)

  • @cenbek7028
    @cenbek7028 Pƙed 3 lety

    excellent!!

  • @DevOpsDirective
    @DevOpsDirective  Pƙed 3 lety +2

    Another new software CZcamsr ItGuyMichal coincidentally released a docker-compose video yesterday as well (czcams.com/video/UBFiCfbRykE/video.html)
    His is a longer form tutorial (~40 min) where he walks through setting up docker-compose for configuring Postgres, pgAdmin, and Jupyterlab to work together.
    If you are looking for a more in-depth explanation/walk through, definitely check out his video and channel!

  • @shekharaakula6233
    @shekharaakula6233 Pƙed 3 lety

    Great video, finally managed to make a monorepo work with docker but I want to know how to enable live reloading with this for development.

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +2

      Hey @Shekhar -- I'm glad it helped! I have implemented a few hot reloading docker configurations durin live streams on the channel, but it might be woth creating a dedicated video about how to use volume mounts to allow source code changes to be represented inside the container in real time.

    • @shekharaakula6233
      @shekharaakula6233 Pƙed 3 lety

      @@DevOpsDirective That's great, I'll also check out your other vids.

  • @SamarthRawat
    @SamarthRawat Pƙed rokem

    Thanks for the amazing tutorial. I am learning docker, your video really helped me learn to dockerize the MERN app. But the I am not able to add movie. when i open localhost:5000 i get "Hello world" as result. Please help me understand this

  • @datamike7457
    @datamike7457 Pƙed 3 lety

    Do you have an example of a docker compose for the ml stack?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      I don't have any good examples on hand, but that could make a good future video!
      One example (which is admittedly a bit contrived...) could be if we took the movie MERN application from the video and wanted to add a "predicted rating" feature with an ML model (using inputs such as the title, the list of actors, the budget for the film, etc...).
      We would wrap our trained model with a lightweight webserver to enable it to accept requests, execute the model, and respond with the results. Once we had that, we would add this new inferencing API as another service within the docker-compose.
      This architecture is nice because we can use whatever language/dependencies we want for the ML model (independent of our technology choices for the rest of the app)!

  • @Operaatoors
    @Operaatoors Pƙed 3 lety

    I would suggest to keep close the database mount, not using named volume but directly storing db data into folder

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      Yes, that is a good point. That way if you ever prune all the dangling docker resources the data can still persist!
      Since this is just a development setup it's not too critical, and if deploying a configuration like this you probably don't want to run the DB in docker at all!

  • @pavanvere5769
    @pavanvere5769 Pƙed 2 lety

    How to change ip address with docker-compose instead of
    hardcoding

  • @SaikumarN1993
    @SaikumarN1993 Pƙed 3 lety

    Do I need to understand coding part for building thia docker compose file

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      While you could technically run the app without understanding the code, it will be much more useful to you if you do (because you will then be able to modify and extend it to fit your needs)

  • @kenny8422
    @kenny8422 Pƙed 3 lety +1

    Great video! I'm learning docker and this was a great resource. Question though: Wouldn't the react-app depend on the api-server the same way the api-server depends on the mongo container?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +9

      Great question! You are correct that in order to successfully load the page with the movie results in your browser, the react app needs the API server to be running.
      The difference is that those requests happen when you load the page not when you start the app! The react app is perfectly happy to start up independent of the other two services, whereas the API server will crash if it can't authenticate to the DB upon start up!
      I hope that helps!

  • @zymasethecatalyst
    @zymasethecatalyst Pƙed 3 lety

    I want to use my mongodb atlas uri instead of mongo image How can i do so?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      In this video I swap out the local DB for one running in atlas using an environment variable for the connection URI (czcams.com/video/DftsReyhz2Q/video.html)
      I hope that helps!

  • @aram5642
    @aram5642 Pƙed 2 lety

    What was it that made Docker and the whole idea of containerization possible?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 2 lety

      Linux namespaces (used to confine what a process can see) and cgroups (used to limit the amount of resources a process can use) are the key! Docker came along and make the user experience for using these much nicer! 😀

  • @k4nful
    @k4nful Pƙed 3 lety

    What should we care if we want to use this docker compose file in production mode?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      Great question, I actually have been planning a follow up to this video in which I show the steps that I would take before deploying this application.
      The updated code is already located here: github.com/sidpalas/devops-directive/tree/master/2020-12-21-productionize-mern
      But I haven't had a chance to film it yet... Feel free to join the channel discord if you have additional questions about the setup!
      discord.gg/d6geMBSg3M

  • @andreigatej6704
    @andreigatej6704 Pƙed 3 lety

    Thanks for the great video! Just a small question. I assume the directory structure was something like this:
    ```
    /
    api-server/
    react-app/
    ...
    ```
    My question is, what happens if the `api-server` has its own repo? Is cloning the repo into an `api-server` directory and keeping it up to date a viable solution?
    Thanks!

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      Great question @andrei!
      Git actually has a feature called submodules that is designed exactly for this purpose! git-scm.com/book/en/v2/Git-Tools-Submodules
      You can have a separate repo for each service and the a top level repo that references them!

    • @andreigatej6704
      @andreigatej6704 Pƙed 3 lety

      @@DevOpsDirective That's great! I've heard of them in the past and always wondered what they're for. Not it's time to look into it, thanks!

  • @CryptoKosh
    @CryptoKosh Pƙed 2 lety

    â€ïžđŸ”„

  • @oliver1231033
    @oliver1231033 Pƙed 3 lety

    Great explanation, but I have some question:
    Do I have to use NGINX and/or pm2 with this setup? Or is this production-ready?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +3

      Hi Pych_1004 -- good question. This is a development setup and is not production-ready.
      To make it production-ready you would need to do a few things:
      For the React front end you would want to run npm run build (which builds it into a set of static files). These could then be served with something like nginx (you would probably want to add SSL termination w/in nginx as well to support HTTPS).
      For the Database, at the very least you will need to configure it with a password, and if the application becomes popular one of the first steps to scaling would be to move the DB off of the same machine as the server (and people debate whether it is a good idea to run a DB in a container for production at all... devops.stackexchange.com/questions/1293/what-are-the-reasons-docker-should-not-be-used-for-databases)
      Perhaps in the future, I'll do a follow-up video showcasing these steps!

    • @bryanmullen4462
      @bryanmullen4462 Pƙed 3 lety

      @@DevOpsDirective +1 on this, would love to see how to make a set up like this production ready

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      @@bryanmullen4462 Awesome -- thanks for the input. I will put it into the backlog of future video ideas!

  • @scoopedcontent
    @scoopedcontent Pƙed 3 lety

    My data is not displayed from database nor am I able to create new movies. It all worked before docker compose though . Can anyone help

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      CZcams comments are very cumbersome for technical discussions, but if you want to join the channel discord community someone can probably help! discord.gg/ExrENts5CT

  • @OfoeNelson
    @OfoeNelson Pƙed rokem

    Thank you for this video. So how do you scale your containers if you want to scale after using docker compose?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed rokem +1

      If by " scale" you mean "run multiple copies of", Docker compose isn't really designed for that. For managing lots of replicas of your application containers you want an orchestrator like docker swarm, hashicorp nomad, or kubernetes.
      You could also deploy multiple copies of the container yourself but once you go beyond a single machine, you will end up hacking together your own version of an orchestrator 😆

    • @OfoeNelson
      @OfoeNelson Pƙed rokem

      @@DevOpsDirective Ok I asked because I'm thinking of how companies scale their container databases

  • @joshuastrozzi737
    @joshuastrozzi737 Pƙed rokem

    I'm new to deploying apps. Why do we containerize our react app? I understand the backend and database, also microservices, but why the front end?? How do you even deploy a containerized front end? Wouldn't you want to just deploy the static files? Clarity on this is appreciated! :)

    • @DevOpsDirective
      @DevOpsDirective  Pƙed rokem +1

      This is a great question!
      For deployment: You are correct that you would want to deploy the output of your build step (i.e. the static files it produces). There are lots of ways to do this, one of which would be to bundle those files into a container with something like nginx and deploy that way. If you are already deploying your other applications with a container orchestrator, this allows you to deploy and operate everything in the same way.
      For development: If you containerize it you can include it within your docker-compose setup so that everyone working on it will share a common setup (rather than needing everyone to have the same versions of all the system dependencies (e.g. node, vite, etc...)
      Hopefully that helps!

  • @afshaarahmed2114
    @afshaarahmed2114 Pƙed 2 lety

    ERROR: In file './docker-compose.yml', service 'image' must be a mapping not a string

  • @hangtran4863
    @hangtran4863 Pƙed 2 lety

    When running docker-compose up , I stumbled upon this error "ERROR: pull access denied for react-app-dev, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 2 lety +1

      This error message means you do not have a docker image with that tag locally so it is trying to pull one from DockerHub.
      This makes me think you probably did not build the image before running docker compose up!

  • @stsbmu7169
    @stsbmu7169 Pƙed 3 lety

    Hello! Thank you very much for video! I would like to ask about the best way to work with Windows environment? In that I mean, I have multiple services and front-end applications are already dockerized and working well. But I have one service built on Node, which requires to be running on Windows 2016 server and for that I do all updates each time manually. Could you suggest what wholesome delivery method I can use for these?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      While I haven't worked with them, I know there are windows base docker images (hub.docker.com/_/microsoft-windows-base-os-images).
      This pull request (github.com/nodejs/docker-node/pull/362) shows someone using those base images to create a windows based Node image, but it looks like it hasn't been approved/merged yet. Maybe it will give some guidance on how to achieve what you are hoping for though!

    • @stsbmu7169
      @stsbmu7169 Pƙed 3 lety

      @@DevOpsDirective Thank you very much! I will do more studying on it

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      @@stsbmu7169 Report back as you make progress! As I said, I have not worked with Windows based containers, so I'm interested to hear about your experience with them!

    • @stsbmu7169
      @stsbmu7169 Pƙed 3 lety

      @@DevOpsDirective I will do!

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      @@stsbmu7169 FYI, I recently started a discord server to make discussions like this easier than YT comments. Come join if you want! discord.gg/CHRvYhwvej

  • @jackedelic9188
    @jackedelic9188 Pƙed 3 lety +1

    I am confused, so before using docker-compose up, do we need to separately build the images for client and server?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      Hi Jack -- For the Dockerfile shown in the video (github.com/sidpalas/devops-directive/blob/master/2020-08-31-docker-compose/docker-compose.yml), I specified the "image" directly so you have to build it first. (using "docker build -t ")
      If instead, I used the build option like here (gist.github.com/sidpalas/850a08326f46839057f611c05fa14f59), then docker-compose could automatically build the images before running.
      Here is the documentation for the build configuration option docs.docker.com/compose/compose-file/#build
      Does that help?

    • @jackedelic9188
      @jackedelic9188 Pƙed 3 lety

      @@DevOpsDirective That absolutely helps :) Thanks for clearing my doubt

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      @@jackedelic9188 Great! Thanks for watching the video and being a part of the community.
      Keep the comments and questions coming!

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      @Mr 3xclamtion Good point!

  • @Chris-mr8qm
    @Chris-mr8qm Pƙed 2 lety

    Noob question here, do you have 1 container that contrains all services (réaction, mongo, api) or we have one container per serice?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 2 lety +1

      Generally you want to keep each container with a single service. There are some hacks you can do to run multiple things in a single container but it makes things harder to reason about, debug, etc...

    • @Chris-mr8qm
      @Chris-mr8qm Pƙed 2 lety

      @@DevOpsDirective Thank you for your answer. last one, is docker compose an orchestration then? how does it defer from kubernetes?

  • @albertoramos4312
    @albertoramos4312 Pƙed 3 lety

    If I'm using a .env with mongo db atlas uri what should I do?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      Hi @Alberto! In this video I configure this app to use Atlas for the DB and use a .env file czcams.com/video/DftsReyhz2Q/video.html
      Hopefully it helps!

    • @albertoramos4312
      @albertoramos4312 Pƙed 3 lety

      @@DevOpsDirective thanks a lot!

  • @PrieyudhaAkaditaS
    @PrieyudhaAkaditaS Pƙed 3 lety

    I have a question.
    What if i made some changes in express js or react js, do I need to type docker compose up again and the application will immediately change?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      As configured in the video you would have to rebuild the image first. In my recent livestream (czcams.com/video/DftsReyhz2Q/video.html) I showed how to mount the source code into the container using a volume so that changes can be reflected immediately!

    • @PrieyudhaAkaditaS
      @PrieyudhaAkaditaS Pƙed 3 lety

      @@DevOpsDirective thankyou, will look forward for it

  • @michellegburgosf
    @michellegburgosf Pƙed 3 lety

    hi Sam!
    Your video is amazing. Could u pls help me use MEVN application for the same? Are The steps so different than MERN? Thank you

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      Hi @Michelle -- It will be quite similar to the code shown in the video, just swapping Vue in for React! You will need to update the "client" implementation with one using Vue.
      Do you have the application running already without docker-compose?

    • @michellegburgosf
      @michellegburgosf Pƙed 3 lety

      @@DevOpsDirective Thank you so much :)

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      @@michellegburgosf You are welcome -- Let me know if you run into issues getting it up and running!

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      @@michellegburgosf How is the MEVN app going? FYI, I recently started a discord server to make discussions like this easier than YT comments. Come join if you want! discord.gg/CHRvYhwvej

  • @pitpat6319
    @pitpat6319 Pƙed rokem

    Where can you build the images? I tried bash but it didn't work

  • @ninow5
    @ninow5 Pƙed 3 lety

    So basically docker compose creates a container with several images? Or does it still create 3 sepparate containers?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      Good question!
      It still creates 3 separate containers, it just manages the set up and tear down (+ networking and volumes) with a single command and allows you to specify everything conveniently in one config file!

    • @agelosnm
      @agelosnm Pƙed 3 lety

      @@DevOpsDirective is it possible to merge them somehow in order to have one container containing those 3 containers as sub-containers? I'm asking in this with the purpose to eventually push my app to docker hub so as to pull & pull the container from anywhere

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      @@agelosnm You technically could run all three processes in one container but it would be bad practice. If one of the services had issues it would impact the others and be much harder to work with.
      It is best to keep each container focused on running 1 thing only.

  • @domemvs
    @domemvs Pƙed 3 lety

    Can you elaborate on the stdin_open option?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +3

      Adding stdin_open: true is the equivalent of using the -i flag in a docker run command
      In this case it is kind of a hack to get around this issue: (github.com/facebook/create-react-app/issues/8688).
      Essentially there was an update earlier this year to React-Scripts that causes the react development server to exit after startup when run inside a docker container (at which point the container shuts down). Adding stdin_open: true tells docker to keep STDIN open even though its not attached to the process which keeps the container alive.
      This is similar to if you were to run:
      $ docker run node:slim
      (the container will start up and immediately terminate)
      versus if you run:
      $ docker run -i node:slim
      (the container will remain up after startup)
      I hope that helps!

    • @domemvs
      @domemvs Pƙed 3 lety

      DevOps Directive Thank you! Awesome explanation!

  • @fkw0k3t4rd5
    @fkw0k3t4rd5 Pƙed 3 lety

    So lets say every part of the project runs in its own directory with different github repos.
    Where exactly does the docker compose file go if there are multiple root directories? Does it go in the root of the front end or the backend?
    I feel like not understanding something fundamental here.

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      Good question!
      For the situation you described I would probably put the docker-compose file at the root of the backend repo and then use the git submodules (www.git-scm.com/book/en/v2/Git-Tools-Submodules) feature to make the frontend repo a sub directory within that repo.
      If there are even more services (each as their own repo) you could even have a separate integration repo which has all the services as submodules.
      My preference is just to use a single repo for everything ("Mono-repo") which simplifies your specific question, but adds its own complications elsewhere...

    • @fkw0k3t4rd5
      @fkw0k3t4rd5 Pƙed 3 lety

      @@DevOpsDirective I was thinking of doing a Mono repos setup myself but wouldn't a large code base of a mono repo present
      more stability, efficiency, and more importantly scalability challenges? The codebase will be large enough to more than likely suffer from one
      or more of these issues.
      "Git fundamentally never really looks at less than the whole repo. Even if you limit things a bit (ie check out just a portion, or have the history go back just a bit), git ends up still always caring about the whole thing, and carrying the knowledge around.
      So git scales really badly if you force it to look at everything as one huge repository. I don't think that part is really fixable, although we can probably improve on it."
      -Linus Torvalds

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      @Andrew -- how big a codebase are you working with? (in either SLOC or team size)
      The majority of projects will never reach a scale where Git itself becomes the bottleneck.
      For me, the benefits of being able to more quickly navigate and refactor across the codebase usually outweigh the (slightly) slower sync times or the need to configure CI/CD to be smart about detecting which services have been modified.

    • @fkw0k3t4rd5
      @fkw0k3t4rd5 Pƙed 3 lety

      ​@@DevOpsDirective I'm not sure what the SLOC will be because the project is still in the early stages. I'm a few weeks into creating the api using TDD and my endpoint tests alone
      are almost 5k lines of code.
      Edit: The tests I have so far are only for about 15 endpoints. I still have at least 30 to go.
      Hopeful that gives you an idea of the possible app scale.

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      @@fkw0k3t4rd5 Yeah, I doubt you would have issues with something of that scale.
      I would choose whichever structure you are more comfortable with and will enable you to move the fastest during this initial development phase.

  • @md.fazlulkarim8847
    @md.fazlulkarim8847 Pƙed 3 lety

    Awesome

  • @rangabharath4253
    @rangabharath4253 Pƙed 3 lety

    awesome

  • @bharathram3977
    @bharathram3977 Pƙed 3 lety

    I am getting errors like this. Can you help me out?
    Pulling mongo (mongo:)...
    Traceback (most recent call last):
    File "site-packages\docker\credentials\store.py", line 80, in _execute
    File "subprocess.py", line 395, in check_output
    File "subprocess.py", line 487, in run
    subprocess.CalledProcessError: Command '['C:\\Program Files\\Docker\\Docker\
    esources\\bin\\docker-credential-desktop.EXE', 'get']' returned non-zero exit status 1.
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
    File "site-packages\docker\auth.py", line 264, in _resolve_authconfig_credstore
    File "site-packages\docker\credentials\store.py", line 35, in get
    File "site-packages\docker\credentials\store.py", line 93, in _execute
    docker.credentials.errors.StoreError: Credentials store docker-credential-desktop exited with "error getting credentials - err: exec: "docker-credential-wincred.exe": executable file not found in %PATH%, out: ``".
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
    File "docker-compose", line 6, in
    File "compose\cli\main.py", line 72, in main
    File "compose\cli\main.py", line 128, in perform_command
    File "compose\cli\main.py", line 1078, in up
    File "compose\cli\main.py", line 1074, in up
    File "compose\project.py", line 548, in up
    File "compose\service.py", line 361, in ensure_image_exists
    File "compose\service.py", line 1250, in pull
    File "compose\progress_stream.py", line 102, in get_digest_from_pull
    File "compose\service.py", line 1215, in _do_pull
    File "site-packages\docker\api\image.py", line 396, in pull
    File "site-packages\docker\auth.py", line 48, in get_config_header
    File "site-packages\docker\auth.py", line 324, in resolve_authconfig
    File "site-packages\docker\auth.py", line 235, in resolve_authconfig
    File "site-packages\docker\auth.py", line 281, in _resolve_authconfig_credstore
    docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-desktop exited with "error getting credentials - err: exec: "docker-credential-wincred.exe": executable file not found in %PATH%, out: ``".')
    [16672] Failed to execute script docker-compose

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +1

      Hi Bharath --
      Lets first confirm if your Docker Desktop install is working properly. What do you get if you test the docker version ("docker --version")?
      Also, can you run "docker run hello-world" (which will pull and run hub.docker.com/_/hello-world)?

    • @bharathram3977
      @bharathram3977 Pƙed 3 lety

      @@DevOpsDirective Hi there, thanks for response. I figured out the issue. I was running all commands from Git bash in windows instead of Windows command prompt which somehow caused something to go wrong.
      But then, I ran into another error ( I have also posted it in stack overflow): stackoverflow.com/questions/63903112/mongo-connection-error-mongonetworkerror-failed-to-connect-to-server-localh

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      @@bharathram3977 It looks like the Stack Overflow question was removed... did you figure out the issue?

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      @@bharathram3977 FYI, I recently started a discord server to make discussions like this easier than YT comments. Come join if you want! discord.gg/CHRvYhwvej

  • @Quick_Code
    @Quick_Code Pƙed 10 měsĂ­ci

    super easy

  • @GameChanger_SR
    @GameChanger_SR Pƙed 3 lety

    Hey man you are amazing , your explanation is clear and simple ,can you make a video on "how to deploy this application on GCP compute engine "
    thankyou dear

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety

      Thanks @music! -- I have had a few people express interest in follow-ups to this video, so I will definitely make one! (not sure when though)

  • @ridl27
    @ridl27 Pƙed 3 lety

    ty.

  • @andrewgalloway8012
    @andrewgalloway8012 Pƙed 2 lety

    I'm not sure how this stuff ends up working for people. I'm sure I'm doing something wrong, but it's always endless shots in the dark for me when it comes to Docker. I just want to get back to writing code :(

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 2 lety +1

      It is a fairly steep learning curve because of the additional abstraction, but once configured you shouldn't have to touch it much and hopefully will get teams writing code faster!

  • @jerrysofttechy6404
    @jerrysofttechy6404 Pƙed 2 lety

    great

  • @maxkinli
    @maxkinli Pƙed 5 měsĂ­ci

    You can’t just run react app in webpack dev server and say this is your react docker container

  • @andTutin
    @andTutin Pƙed rokem

    whats the point any of this

  • @maxkinli
    @maxkinli Pƙed 5 měsĂ­ci

    I’m in shock. 50 y.o guy teaching the wrong stuff
 this is the real problem. Why this even exist

  • @befrog57
    @befrog57 Pƙed 3 lety +39

    Amazing video! You explained everything in a very understandable and clear way without oversimplyfing it. Love it

    • @DevOpsDirective
      @DevOpsDirective  Pƙed 3 lety +2

      Great to hear -- that is always my goal!

    • @lionelaustin5523
      @lionelaustin5523 Pƙed 3 lety

      I realize it is kinda randomly asking but do anybody know of a good website to stream newly released tv shows online?

    • @geraldvictor3467
      @geraldvictor3467 Pƙed 3 lety

      @Lionel Austin I use flixzone. Just search on google for it :)

    • @salvatoretrey9697
      @salvatoretrey9697 Pƙed 3 lety

      @Gerald Victor yup, have been using FlixZone for since march myself :)

    • @lionelaustin5523
      @lionelaustin5523 Pƙed 3 lety

      @Gerald Victor Thank you, signed up and it seems to work :) I really appreciate it!!