WEBVTT

00:00.660 --> 00:02.760
-: In the last section I had mentioned that I'd cleared out

00:02.760 --> 00:04.830
all the stopped containers on my machine,

00:04.830 --> 00:07.110
and so I thought you might be curious on how I did that.

00:07.110 --> 00:09.930
If I run docker ps --all right now,

00:09.930 --> 00:13.080
I can see that I currently have two stopped containers.

00:13.080 --> 00:14.850
So these containers right now are essentially

00:14.850 --> 00:17.610
just taking up disk space on my computer,

00:17.610 --> 00:18.960
and so it might be to my advantage

00:18.960 --> 00:20.820
to try to entirely delete them

00:20.820 --> 00:23.580
and not just leave them in this stopped state.

00:23.580 --> 00:25.290
To delete all these containers,

00:25.290 --> 00:29.043
I can run docker system prune.

00:30.600 --> 00:32.850
I'll then be presented with a warning here.

00:32.850 --> 00:33.750
So just to be clear,

00:33.750 --> 00:36.840
this is not only going to delete stopped containers,

00:36.840 --> 00:40.320
it's also going to delete a couple of other items as well,

00:40.320 --> 00:42.480
most notably your build cache.

00:42.480 --> 00:44.400
The build cache is any image

00:44.400 --> 00:46.200
that you have fetched from Docker Hub.

00:46.200 --> 00:47.670
So after running docker prune

00:47.670 --> 00:50.760
you will have to re-download images from Docker Hub,

00:50.760 --> 00:52.440
which is not a really big deal.

00:52.440 --> 00:54.090
Just be aware that you're gonna have to wait

00:54.090 --> 00:56.250
a couple of minutes the next time you start up a container.

00:56.250 --> 00:58.920
Not really a couple minutes, but a couple of seconds really.

00:58.920 --> 01:01.740
So we can enter in "yes", hit Enter,

01:01.740 --> 01:04.260
and then it will tell us about the deleted containers

01:04.260 --> 01:06.450
and it'll tell me also how much space

01:06.450 --> 01:09.330
has been reclaimed by deleting those resources.

01:09.330 --> 01:12.450
If I then do another docker ps --all,

01:12.450 --> 01:13.710
I'll see that I do not have

01:13.710 --> 01:16.410
any stopped containers whatsoever.

01:16.410 --> 01:17.850
I really recommend you keep

01:17.850 --> 01:21.570
the docker system prune command in mind,

01:21.570 --> 01:24.060
because anytime that you're kind of done working with docker

01:24.060 --> 01:26.010
for a period of weeks or months,

01:26.010 --> 01:27.720
or if you decide you just don't wanna work

01:27.720 --> 01:29.340
with docker again at all,

01:29.340 --> 01:32.220
you will want to run this command to delete any containers

01:32.220 --> 01:33.990
that are still just kind of sitting around

01:33.990 --> 01:35.820
eating up disk space.

01:35.820 --> 01:37.170
All right, let's take another quick break,

01:37.170 --> 01:39.120
and we'll continue in the next section.
