在Docker-Compose中禁用一个容器的日志记录 [英] Disable logging for one container in Docker-Compose

查看:305
本文介绍了在Docker-Compose中禁用一个容器的日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Docker启动的Web应用程序,我想要禁用所有日志记录(或者至少将其打印到syslog而不是文件中)。

I have a web application launched using Docker compose that I want to disable all logging for (or at the very least print it out to syslog instead of a file).

当我的Web应用程序运行时,它可以在启动时快速生成一个11GB的日志文件,因此这会非常快地吞噬我的磁盘空间。

When my web application works it can quickly generate an 11GB log file on startup so this eats up my disk space very fast.

我知道普通docker拥有日志记录选项用于其运行命令,但在Docker Compose中我使用

I'm aware that normal docker has logging options for its run command but in Docker Compose I use


Docker-compose up

Docker-compose up

在应用程序文件夹中以启动我的应用程序。我该如何启用此功能?我看不到在线上任何地方的特殊情况。

in the application folder to start my application. How would I enable this functionality in my case? I'm not seeing a specific case anywhere online.

推荐答案

您应该可以使用记录功能。尝试将驱动程序设置为无

You should be able to use logging feature. Try to set driver to "none"

logging:
    driver: none

这篇关于在Docker-Compose中禁用一个容器的日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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