Suppress output from Codeship service

拟墨画扇 提交于 2021-01-28 04:46:14

问题


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.

I'm currently running it with mongod --quiet --setParameter logLevel=0 but getting a lot of output still.

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

setting from docker-compose doesn't seem to work.

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

回答1:


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



回答2:


If you want to get rid completely of MongoDB logs, you can redirect all output of mongod command to \dev\null.

mongod --quiet --logpath /tmp/mongo.log --setParameter logLevel=0 > /dev/null 2>&1



来源:https://stackoverflow.com/questions/43319795/suppress-output-from-codeship-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!