Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

docker

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

What is this "diff" folder for?

like image 318
aerin Avatar asked Jun 03 '18 00:06

aerin


People also ask

Why is aufs not working in Docker?

AUFS cannot use the following backing filesystems: aufs, btrfs, or ecryptfs. This means that the filesystem which contains /var/lib/docker/aufs cannot be one of these filesystem types. If the AUFS driver is loaded into the kernel when you start Docker, and no other storage driver is configured, Docker uses it by default.

What is a diff in Docker?

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.

What does the aufs/diff Directory contain?

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.

What is/layers/in Docker?

layers/: metadata about how image layers are stacked. This directory contains one file for each image or container layer on the Docker host. Each file contains the IDs of all the layers below it in the stack (its parents).


2 Answers

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

like image 196
Dr.Knowitall Avatar answered Oct 22 '22 23:10

Dr.Knowitall


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 a a 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

like image 5
user3483203 Avatar answered Oct 23 '22 01:10

user3483203