禁止Codeship服务的输出 [英] Suppress output from Codeship service
问题描述
我正在用Codeship测试一个需要数据库的容器.使用codeship-services.yml中的服务,我正在将数据库容器链接到应用程序容器.问题在于数据库容器正在打印很多输出,这些输出与测试的输出混合在一起.我想完全摆脱MongoDB日志,但是MongoDB没有选择这样做.
I'm testing a container in Codeship that requires a database. Using services in codeship-services.yml I'm linking the database container to the application container. The problem is the database container is printing a lot of output that gets mixed with the output of the tests. I want to get rid of the MongoDB logs completely but MongoDB doesn't have options to do that.
我目前正在与 mongod --quiet --setParameter logLevel = 0
,但仍然获得大量输出.
I'm currently running it with
mongod --quiet --setParameter logLevel=0
but getting a lot of output still.
因此,我正在寻找Codeship方面的解决方案,以禁止来自容器的输出(以Codeship术语表示的服务).
So I'm looking for a solution on the Codeship side to suppress output from a container (service in Codeship terms). The
logging:
driver: none
从docker-compose设置似乎无效.
setting from docker-compose doesn't seem to work.
这是我的codeship-services.yml:
Here is my codeship-services.yml:
myapp:
build:
dockerfile: Dockerfile
image: myapp
cached: true
links:
- database
database:
image: mongo:3.4.3
command: mongod --quiet --logpath /tmp/mongo.log --setParameter logLevel=0
推荐答案
如果要将MongoDB日志重新路由到/dev/null
,从而完全摆脱它们,则应替换路径由键-logpath
指定的日志输出.例如:
If you want to reroute the MongoDB logs to /dev/null
, thereby getting rid of them entirely, you should replace the path for the log output specified by the key --logpath
. For instance:
database:
image: mongo:3.4.3
command: mongod --quiet --logpath /dev/null
这篇关于禁止Codeship服务的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!