docker container limits the size of the log

1. Create a 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

{
  "log-driver":"json-file",
  "log-opts": {"max-size":"500m", "max-file":"3"}
}

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.

 

2. Then restart the daemon thread docker

Command is as follows:

systemctl daemon-reload
systemctl restart docker

 

Guess you like

Origin www.cnblogs.com/aikutao/p/11511088.html