#100DaysOfWeb in Python Transcripts
Chapter: Days 97-100: Docker and Docker Compose
Lecture: Concept: Core Docker commands

Login or purchase this course to watch this video and the rest of the course contents.
0:00 You saw a ton of docker commands through this whole thing and throughout these demos. And if you are like me the first time I saw that whole experience
0:09 your head was probably spinning. You're like docker ps, docker images, docker build docker run, docker -it, what is this it?
0:16 Ah, what are all these commands mean? So here's a video to try and put those all together and really highlight the few essential ones
0:24 that you need all the time. And then the ones that maybe you use less often well, there's Google right? Okay, so we're going to start out with
0:32 some kind of dockerfile here. And we're going to say docker build. And that's going to build whatever dockerfile is in here actually in this listing.
0:42 I have it in the wrong location. But, it's going to build that file, whatever's right there. So docker build.
0:49 that's going to build some kind of container and it's going to give it a name, 9F111533, super name. And any changes to the container definition
1:02 will change that. So docker build, helpful and you can just run you know 9F and it would go but sometimes you need something more stable
1:10 like one docker file is going to refer to another one that you're building. So we can say docker build and put a -t
1:19 here we'll call it movie services colon latest. So name and then tag. So now when it builds it, you're going to see it's going to build like this.
1:28 And it's much easier to have a set of commands that always works against it to look at a command history and know what the heck it meant
1:35 'cause docker run 9511, what does that mean? Yeah, after a few moments you won't remember. Okay, so be sure to name and tag your images.
1:46 Now if we want to run it, we're going to say docker run and then give it that tag name. This case, it ran and I exited. That was kind of cool.
1:55 I mean I guess something happened, docker run. That was fun, it didn't have an error. But it's not very practical, right? So let's try again.
2:02 So we're going to say docker run and now we're going to say in interactive mode with a terminal attached, we want to run bash.
2:10 When we do that, we end up over here inside our app. Notice that now the prompt has changed and we're basically inside the container
2:17 able to type and work with it and debug it and try commands and just see what works. So any time you're having trouble, give it one of these.
2:25 You can drop inside and try some commands and play around till you figure it out. Now it was great that we ran it with bash to play with it
2:34 but it's a web server. It's intent is to you know, serve things. So here we come over and give it an entry point. We didn't try to run the container
2:43 with the alternate behavior after setting the entry point explicitly so the little run doesn't help us much. You got to set an explicit entry point
2:51 to override the entry point. So here, here's how you do that. And we're saying run app V and V band Python and give Python the command app.py.
3:04 That'll make it go. We also expose the port, so -p 7007: So on the local host, on the server, the host machine. Support 7007 is going to map to the
3:17 inside the container, 7007 as well. Okay that's all good. And then finally, once you have all these running you might open either a new prompt.
3:26 Or if you've run them in the background you might wonder, well what is running? So you can say docker ps.
3:32 That's most of the commands that you're going to need to get started and get things going. Of course, there's always Google
3:39 and there's a good reference on docker's website, itself. I don't want to go through and overwhelm you with too many things.
3:45 Hopefully this little take away will give you enough to work with for the most part.

Talk Python's Mastodon Michael Kennedy's Mastodon