Why is Docker filling up /var/lib/docker/overlay2?

You might have switched storage drivers somewhere along the way, so maybe docker is just cleaning out those drivers but leaving overlay2 as is (I still can’t understand why would pulling images would fail).

Let’s try this, run docker info and check what is your storage driver:

$ docker info

Containers: 0
Images: 0
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: true
<output truncated>

If it is not overlay2 (as appears above) try switching to it, and then prune docker images again and check if that cleaned up that folder.

Another possible solution is mentioned in this thread, people are commenting that clearing logs solves this problem, so try the following:

  1. Remove all log files:
    find /var/lib/docker/containers/ -type f -name "*.log" -delete
    
  2. Restart docker daemon (or entire machine):
    sudo systemctl restart docker
    

    or

    docker-compose down && docker-compose up -d
    

    or

    shutdown -r now
    

Leave a Comment