Search code examples
loggingdockercoreosdiskspace

Docker container logs taking all my disk space


I am running a container on a VM. My container is writing logs by default to /var/lib/docker/containers/CONTAINER_ID/CONTAINER_ID-json.log file until the disk is full.

Currently, I have to delete manually this file to avoid the disk to be full. I read that in Docker 1.8 there will be a parameter to rotate the logs. What would you recommend as the current workaround?


Solution

  • Docker 1.8 has been released with a log rotation option. Adding:

    --log-opt max-size=50m 
    

    when the container is launched does the trick. You can learn more at: https://docs.docker.com/engine/admin/logging/overview/