简体   繁体   中英

What does docker/aufs/diff directory contain? Why is it so big?

Its size is 20G and it contains tons of hash like 00074a74d6cf2052eeb6a9e61bd2b407b464bce6a23a4596ce2e9100f58b6de6 .

What is this "diff" folder for?

Docker works as a union file system or ufs. A diff in Docker terms is simply the difference in filesystem. Like git, it takes an initial read only image and builds the final container by layering your diffs. Everytime you do something in the container it creates a change in the layer which may be commited to a new image via docker commit. If you know what youre doing you can delete those diffs and clean out your disk space.

Likely there's been many changes or large files committed to those layered or diff file systems.

This will clean out your system. Be careful, it could delete something you might want.

docker system prune

First off, you don't want to interact with files in /var/lib/docker , those are only meant to be interacted with by Docker.

In terms of what the aufs/diff directory contains:

AUFS is a union filesystem, which means that it layers multiple directories on a single Linux host and presents them as a single directory. These directories are called branches in AUFS terminology, and layers in Docker terminology. The unification process is referred to aa union mount.

diff specifically contains:

the contents of each layer, each stored in a separate subdirectory

However, this changes if the container is running, in which case it contains:

Differences introduced in the writable container layer, such as new or modified files.


Source: https://docs.docker.com/storage/storagedriver/aufs-driver/#how-the-aufs-storage-driver-works

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM