Docker容器日志采取我的所有磁盘空间 [英] Docker container logs taking all my disk space

查看:161
本文介绍了Docker容器日志采取我的所有磁盘空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在VM上运行一个容器。我的容器默认将日志写入到/var/lib/docker/containers/CONTAINER_ID/CONTAINER_ID-json.log文件中,直到磁盘已满。



目前,我必须手动删除此文件,以避免磁盘已满。我读到在Docker 1.8中,将有一个参数旋转日志
您将推荐什么作为当前的解决方法?

解决方案

Docker 1.8已经发布了日志轮换选项。添加:

   -  log-opt max-size = 50m 

当容器启动时,会发挥作用。您可以通过以下方式了解更多信息:
https://docs.docker.com/engine/admin/logging / overview /


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?

解决方案

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/

这篇关于Docker容器日志采取我的所有磁盘空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆