Created
September 16, 2014 09:05
-
-
Save stefanfoulis/604ea00fd66eea03607b to your computer and use it in GitHub Desktop.
delete docker logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find /var/lib/docker/containers/ -type f -name "*.log" -delete |
an alternative may be activating log rotation for the docker daemon by creating/updating /etc/docker/daemon.json
:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "15m",
"max-file": "5",
}
}
Note that you will need to restart docker (e.g. systemctl restart docker
) and the config only affects containers created after modifying the daemon configuration (e.g. recreate the container of a specific service in docker-compose: docker-compose up --force-recreate --no-deps -d <service-name>
).
For more information see: https://docs.docker.com/config/containers/logging/json-file/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had to run this first