#100DaysOfWeb in Python Transcripts
Chapter: Days 97-100: Docker and Docker Compose
Lecture: Concept: Introduction to docker-compose

Login or purchase this course to watch this video and the rest of the course contents.
0:00 To introduce you to Docker Compose let's review what we have been doing. We had a couple of docker files
0:07 one like this, and we'd issue commands at it, individually. So, docker build this, and we had some other dockerfiles and maybe we want to build those
0:15 so we'd say, build this one and it's based on that one that you had to manually remember to build or it'll get out of sync before.
0:23 Well so, maybe you have another one and we're going to build it. And if we want to run the container for the first one we have to type docker run
0:29 the container name or container id. Well, did you make sure you built it before you ran it? Oh, and this one also depends on the other one
0:36 so don't forget to run that, and it can be challenging to run these multi-container applications.
0:42 And yet, that's exactly what most real applications are. They've got some database stuff, they've got some front-end
0:48 web server stuff, they've got logical web server bits and something like the Python backend, you know
0:55 maybe Pyramid, Flask or Django, something like this. So, all this coordination, this is not good.
1:01 Doing this manually is super error prone and it's not fun. It would be nice if there was a way to say you see this system here on the screen
1:09 build it, run it and control it as a single unit. That is Docker Compose. So, if we look at this differently we still have our three docker files
1:17 that we defined exactly as we had before but now we have one supervisor file if you will, called docker-compose. And Docker Compose can do things like
1:28 build all of those and run all of them and monitor the resulting containers that are running. So, we just issue a simple command
1:35 to our docker-compose file, docker-compose up and it says okay, in our file we refer to these three docker files, so we're going to build them
1:43 and then we're suppose to run them and it's going to run and now their running as a single unit. The builds happen in the right order
1:49 the runs happen in the right order and then we can even monitor the running containers and control this entire system as a single thing.
1:57 So, these are often refer to as services within Docker Compose. You'll see we're actually right on the door step of already being able to do this.
2:06 In fact, all we have to do is define a single docker-compose.yml file that talks about the various components in terms
2:13 of the individual docker images and containers and so on and then we just say docker-compose up, it's going to be great.


Talk Python's Mastodon Michael Kennedy's Mastodon