TheUnreal
TheUnreal

Reputation: 24472

Docker 'overlay' takes too much size - how to debug?

running df -h I get:

overlay          79G   70G  5.8G  93% /var/lib/docker/overlay2/a7bcb73019b20505a640593453aee3578647e027ccf90a607ad1806a9b25edd4/merged

Any idea how I can check why it takes so much space?

Upvotes: 3

Views: 7624

Answers (2)

scandel
scandel

Reputation: 1822

I come a bit late, but this question is a recurring one, and I think this is lacking a diagnose step.

As @bmitch says, first check the size of /var/lib/docker.

If docker is the problem, then run: docker system df. An example of output:

TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          14        4         5.734GB   3.299GB (57%)
Containers      4         4         2.203MB   0B (0%)
Local Volumes   242       2         15.26GB   14.66GB (96%)
Build Cache     425       0         64.32GB   64.32GB

With that, you can cleary see what is taking space, and clean selectively.

In some cases (mine), the build cache is the problem. You can safely delete it with docker builder prune. The usual options for prune can apply (--all, --filter).

For images, volumes, use the classical prune commands.

Upvotes: 1

BMitch
BMitch

Reputation: 263906

An overlay filesystem, like a bind mount, doesn't use any disk space itself. What's reported is the disk space of the underlying filesystem. In this case, if you run df /var/lib/docker you'll see the same disk space allocated to that underlying filesystem, and you can review what is used on that mount.

If the issue is docker, then docker system prune would be a first step. If that doesn't help and you see significant usage from the /var/lib/docker folder you want to clean, see this answer for additional suggestions.

Upvotes: 3

Related Questions