docker overlay2 take up a lot of disk space approach

When using docker, often appear out of disk space, usually the cause of the problem is because the system docker deployed a large number of log output content.

In this case, it can be removed by manual or timed task.

For / var / lib / docker / overlay2 space occupied by a large number of solutions available online, some misleading statement needs to operate migration paths. In fact, the disk space occupied and overlay does not matter (it's real usage of disk usage and the same), it's just a docker's virtual file system, the file system is a former real / dev / vda1, meaning you can see the path to the root directory, so you have to go where there is a trash.

Under normal circumstances and under the same directory overlay2 will have the following directories:

[root@iZ docker]# ls
builder  buildkit  containerd  containers  image  network  overlay2  plugins  runtimes  swarm  tmp  trust  volumes

The log files often take up a lot of space located in containers under, there is a directory in the directory:

[root@iZ containers]# ls
123ace927dc96745bac8ae09d0feddbdef853ff089c831bc80547b2d1115b0ac  635619a5ce22b551c5c75095b8b01647b9a02c839be64cd465e1542bfbec8ee6  a979b62fc10ab0ac54af4799d40c2c5865099883ff124012328ab3a8587c1dda

There will be a file directory to a directory named prefix to "-json.log" suffix in the directory. Use the following command to see the size of the file:

ll -h

Then clean up the contents of the file using the following command:

cat /dev/null > *-json.log

Cleanup completed not restart the service, but if allowed to restart the recommended docker service.

In this execution df -h command after, you will find overlay2 occupied disk space has been reduced.

About scrubbing operation can refer to the article: " LINUX CENTOS / VAR / LIB / Docker / CONTAINER directory lead to full system memory, taking up a lot of storage solutions ."

Original link: " Docker overlay2 take up a lot of disk space approach ."


New Horizons program

No public "program New Horizons", you let a soft power, hard synchronous lifting technology platform

csdn- micro-channel public number

Published 528 original articles · won praise 5051 · Views 3.29 million +

Guess you like

Origin blog.csdn.net/wo541075754/article/details/104118002