Interview Prep/Linux/Disk, Capacity & Backups

How do you clean up disk space safely on Docker hosts?

IntermediateProductionDisk, Capacity & Backups
Answer
docker system df
docker image prune -a --filter "until=168h"
docker container prune
docker builder prune --keep-storage 10GB
sudo du -sh /var/lib/docker/containers/*/*-json.log | sort -h | tail

Prevent container log growth with /etc/docker/daemon.json: "log-driver": "json-file", "log-opts": {"max-size": "50m", "max-file": "3"}. Avoid docker volume prune unless you are certain no data volumes matter.

All Linux questions Roadmap: Linux

More on Disk, Capacity & Backups