docker / cli

The Docker CLI
Apache License 2.0
4.85k stars 1.91k forks source link

feature: `docker system df` also display local log size #2715

Open heitorPB opened 4 years ago

heitorPB commented 4 years ago

Description

One of our servers' disk was completely full.

Docker images + containers + volumes + build cache (as reported by docker system df) was not nearly equal to du -h -d 0 /var/lib/docker. We had 30 GiB of json.logs. Some other people on StackOverflow had similar problems with disk full and not finding the problem.

It would be nice if docker system df also had a local logs entry, like:

$ docker system df
TYPE             TOTAL    ACTIVE    SIZE       RECLAIMABLE
Images           21       18        16GB       10.07GB (60%)
Containers       18       17        812.8MB    15.24MB (1%)
Local Volumes    69       14        6.428GB    395.9MB (6%)
Build Cache      0        0         0B         0B
Local log        18       18        30GB       0B

Of course, this only works for the logging drivers that save the files on the same machine (local, json-log, ...). For remote logging, it is another story.

Output of docker version:

Client:
 Version:           18.09.7
 API version:       1.39
 Go version:        go1.10.1
 Git commit:        2d0083d
 Built:             Fri Aug 16 14:20:06 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.09.7
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.1
  Git commit:       2d0083d
  Built:            Wed Aug 14 19:41:23 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

Containers: XX
 Running: XX
 Paused: XX
 Stopped: XX
Images: XX
Server Version: 18.09.7
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version:
runc version: N/A
init version: v0.18.0 (expected: fec3683b971d9c3ef73f284f176672c44b448662)
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-1031-oracle
Operating System: Ubuntu 18.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.66GiB
Name: xxxx
ID: D246:MT7L:TCMQ:ZF5W:AGKZ:767O:DBMD:REXV:HWID:ALVQ:FOAZ:2AJL
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.): any

mqu commented 3 months ago

this feature was missing for me too ! I have extended a virtual disk volume 2 times ; looking at docker system df, no thing was clear and obvious.

After some investigation, it was clear docker container logs files was occupy more than 80GB and images and volumes only 15-20GB.