#100DaysOfWeb in Python Transcripts
Chapter: Days 97-100: Docker and Docker Compose
Lecture: Docker cleanup and reclaiming disk space

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Feels like time for some celebration. We got the whole thing working, right? Well, there's a few little clean-up things we could do here.
0:08 So if we look at what's running stop the containers nothing's running. Seems like everything's fine. Except, well
0:17 there is a lot of junk we built up on this system. Now these containers are kept here so you can restart them
0:23 go look at their logs or interact with them. But we don't want to do that. And if we similarly look at images we see there are these images
0:33 and if you look at that and say show me all the intermediate ones woo, there's even more. So there's a couple of things we can do to clean that up.
0:42 First of all we can work on let's work on the containers first because they may have references back to the images.
0:49 So you might think there's a cool command like docker delete containers --done whatever, like no. There's not.
1:02 So there is a docker rm command which will remove a container but it only works on individual ones so a way
1:10 we've got to do a little UNIX-y magic to say docker remove all the containers whose names are you know, all of these whether they've been quitted.
1:19 They've stopped. Okay, so we do that, woo. That's better. docker ps -a, ooh. All of them. Now there's a little better one for image. You can say prune.
1:34 It says this will remove all dangling images. It'll say do you want that yes, we want that. And we reclaimed almost 200 megs.
1:43 So we still have a couple of images that were built here. But we're in a much better place having cleaned all of those up.
1:52 Oh it looks like I could do one more thing as well. prune -a to get rid of all of them. That's okay, no effect. But that'll get rid of
2:01 even more potentially. So now if we just look at all the images that's good now we just ask what are here.
2:09 Right, a nice clean set of just the working ones. There you go so don't forget to clean up after yourself.


Talk Python's Mastodon Michael Kennedy's Mastodon