Transcript from the "Docker Compose Up" Lesson
>> Burke Holland: So while that's happening, let's take a look at some of these other files here. There is a docker-compose file, let's talk about that for a second. This is a compose file, so how does the compose file relate to our docker file? What compose file does is it allows you to specify multiple images, and then link them together.
[00:00:18] So let's imagine if you would for a second that we want to have MongoDB. And we wanna deploy MongoDB as part of our container. One way we could do that is to just add another container, and link those two containers together in the same image. So to do that, what we're gonna do is come down and do a new service called mongo.
[00:00:37] And inside of it, we're gonna specify an image, and we're gonna call that mongo. And then in order to make these two containers so they can talk to each other, we're gonna add a links, and we're gonna link this with mongo. So I'm gonna save this. And now what we wanna do is recreate our image with docker-compose cuz we've got multiple containers now that are gonna be spun up from one image file, and those two containers can talk to each other.
[00:01:06] So now our app can talk to our MongoDB container. So let's do this docker, and we're gonna say compose up, and we gonna say, this folder, pick the compose file
>> Burke Holland: And it's gonna start building, and port 3000's already allocated. But if we go over to our docker extension, look at this, we have a mongo container and it's running, okay?
[00:01:36] So if we were to deploy this image to the cloud, what would happen is, the cloud would pull it in, spin up two containers, and we now deployed our app and our database in one go, boom! And you know it's gonna work because it works on my machine provided something isn't already running on port 3000.