Robycool
Robycool

Reputation: 1224

Docker taking much more space than sum of containers, images and volumes

Docker running on Ubuntu is taking 18G of disk space (on a partition of 20G), causing server crashes. Commands below show that there is a serious mismatch between "official" image, container and volume sizes and the docker folder size.

What causes this and how can I cleanup ?

I already tried docker system prunewhich doesn't help.

du -sh /var/lib/docker

enter image description here

docker system df

docker

du -sh /var/lib/docker/*

enter image description here

du -sh /var/lib/docker/containers/*

enter image description here

Upvotes: 14

Views: 16541

Answers (4)

Aliti
Aliti

Reputation: 2095

Have you ever try this:

docker system prune --all --volumes

Upvotes: 0

Bora Karaca
Bora Karaca

Reputation: 511

I was having the same problem. I solved my problem by deleting log files

sudo sh -c "truncate -s 0 /var/lib/docker/containers/*/*-json.log"

Link: How to clear the logs properly for a Docker container?

Upvotes: 15

user4093955
user4093955

Reputation:

You have two containers that are eating your storage. Those containers must be running, because you said you already ran docker system prune. Otherwise /var/lib/docker/containers would be empty.

So check why are those two consuming so much. Probably they are logging too much to stdout.

Upvotes: 5

kkubina
kkubina

Reputation: 145

docker system prune should clean up old unused layers, I have managed to get lots of disk space back several times with this. Hope it helps.

Upvotes: 1

Related Questions