View Linux disk capacity --df and directories under, du
df: lists the overall disk usage, file system;
du: disk usage, file system assessment (commonly used to assess the capacity of the share directory)
df parameters:
-a: List all file systems, including system-specific / proc file system, etc.
-k: displaying each file system capacity KB
-m: display each file system capacity in MB
-h: easier to read on their own show to people of GB, MB, KB and other formats
-H: In M = M = 1000K carry alternative embodiment of 1024K
-T: along with the name of the file system partition (such as ext3) also lists
-i: no hard drive capacity, and to the inode number to display
docker system df: View disk usage of Docker
du -hs / var / lib / docker / View disk size occupied under docker
docker view the log: docker logs -f container_id / container_name the command to print the log file from scratch
docker logs -f --tail n (there are several designated viewing the most number of logs) container_id / container_name This command is to look at a few of the last log
Maximum log size limit container services, this is achieved by configuring the container docker-compose the max-size options
nginx:
image: nginx:1.12.1
restart: always
logging:
driver: “json-file”
options:
max-size: “5g”
New /etc/docker/daemon.json, if it would not have built. Adding log-dirver and log-opts parameters, the following examples:
# vim /etc/docker/daemon.json
{
"registry-mirrors": ["http://f613ce8f.m.daocloud.io"],
"log-driver":"json-file",
"log-opts": {"max-size":"500m", "max-file":"3"}
}
Note:
max-size = 500m, means a container log maximum size is 500M,
max =. 3-File, means a container having three logs are id + .json, id + 1.json, id + 2.json.
// restart docker daemon
# systemctl daemon-reload
# systemctl restart docker
How to find docker container log file
Generally stored in the container log / var / lib / docker below, the following command can be used to view the log file size of each
ls -lh $(find /var/lib/docker/containers/ -name *-json.log)
Reference Address: https://blog.csdn.net/mofiu/article/details/79021550
View address: https://blog.csdn.net/yjk13703623757/article/details/80283729 (Docker log cleaning)