Daniel vijay Sundar
Daniel vijay Sundar

Reputation: 343

How to clear logs of a docker container when there is no space left out because of docker logs

I have a aws instance where I am running a docker container (let it be for any process). The log file in var/log/docker.log is exceeding the storage of the vm. How can I clear the logs and make the storage available in a very clean way.

Upvotes: 0

Views: 8238

Answers (2)

hellosri
hellosri

Reputation: 389

Use the truncate command to empty the logs

truncate -s 0 /var/log/docker.log

There is mention of an old issue with AWS linux instances not rotating docker logs, and a workaround is to use logrotate and update the user data script. https://github.com/aws/amazon-ecs-init/issues/119

Upvotes: 4

Thanh Nguyen Van
Thanh Nguyen Van

Reputation: 11772

You should empty the log file.

cat /dev/null > /var/log/docker.log

Upvotes: 0

Related Questions