#100DaysOfWeb in Python Transcripts
Chapter: Days 97-100: Docker and Docker Compose
Lecture: Installing glances

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Now I said I also want to install Glances. If you're not familiar with what Glances is it's a cool little command line terminal app
0:07 that shows you all the processes running on your system gives you little graphs and so on. So if you want to log into your docker container and see
0:15 like what are the worker processes and how do they all connect together that's a pretty sweet thing. But it turns out, I believe
0:22 there's going to be a small problem here. Now let's try to run it and then I'll show us something cool on how to fix it.
0:28 Okay, so over here we say, docker build. and I un-commented the Glances bit so you saw I quickly got
0:35 to the first part and then here's a whole bunch of stuff that's going to be installed because of that. Now Glances kind of adds a lot of weight
0:42 a lot of files if that's something that matters to you then, you know, maybe skip it. But it's useful for me now. But notice it stopped
0:50 and it's asking me a question about time zones. That's no good. Technically I could type this in now but what about when we run it automatic
1:00 in some sort of automated build or something? That's not cool. So how do we fix that? Well what we're going to do is we're going
1:06 to set an environment variable up here. Now just to show you what can happen let's set this a little bit sooner so we're going to say
1:13 we want to set an ENV, notice the awesome auto-complete there I set the ENV to values TZ our key is TZ, value is Los Angeles.
1:24 And then we need to write that to a file. So we're going to run a command here which I'm just going to copy and paste to add a line
1:30 to time zone info and run this and echo it out. So what that's going to do is register in Linux the time zone is LA
1:39 in which case Glances won't ask for it again. But notice I put this change, these two changes before those three.
1:47 Now maybe that's not the right place for it but I did it so that will actually show you a little bit, how this builds.
1:53 So if we say build again, it's going to run this part and say, we already have that cached it's going to make these changes and it's going to say
2:00 well that one we had something that was the upgrade of Ubuntu and then sudo itself but we've never seen anything that was upgrade
2:09 and then change the time zone and then sudo. So we've got to start over, right, this is totally different. So you'll see the first two are good
2:15 but now it starts going through and running the install for sudo and those again. I'll skip ahead here cause you don't need to watch it again.
2:22 But this idea of if I make a change before it invalidates the cache for the previous the subsequent ones so we got to rerun that.
2:35 Okay it built this time. Glances didn't ask us any questions it was totally happy and it built all the way through. So we go back here
2:43 now this is kind of the foundation of our server and the next thing we want to do is we want to run something like I'm going to put a little space here
2:50 cause we're later going to refactor this. But the next thing I want to do is install nginx. Well how do I do that? Not too hard. apt-get install nginx.
2:59 So we're going to run this one more time and like I said this stuff could actually be factored into a core foundational image that's based on Ubuntu
3:05 and then our other work could be based on top of this one. So here we go, let's do this again. Notice most things were cached
3:14 we just have to install nginx. Super, so we have our container built and I say docker run interactive for the moment
3:27 this, we're going to run Bash and now I can ask nginx -v for what version it is. And look at that, we have the latest vanilla nginx
3:36 that gets installed if you don't go and reconfigure your system to get a newer one. So look, nginx is all set up and we have Glances running over here.
3:46 Not super interesting, we have Bash and we have Glances running but it does tell us about our system which is kind of cool.

Talk Python's Mastodon Michael Kennedy's Mastodon