Docker container logs taking all my disk space

前端 未结 6 2121
隐瞒了意图╮
隐瞒了意图╮ 2021-01-30 07:53

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.

6条回答
  •  日久生厌
    2021-01-30 08:51

    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/

提交回复
热议问题