Docker logs


One day I noticed that server disk space is running low, the culprit was docker. As I later found out, docker does not limit the maximum filesize of the log files. In order to limit the file size you need to pass some parameters when running containers, you can also make a global config file.

Steps below to make the config:

  • create a file /etc/docker/daemon.json
  • and put this into it: { "log-driver": "json-file", "log-opts": { "max-size": "10m", "max-file": "3" } }

You also need to have in mind, that only new containers will use this configuration.