docker-compose suppress mongodb output

Viewed 2791

This isn't a breaking issue for me, but I have about four images stitched together in a service, postgres, redis, mongodb, and my application which is a python-flask application.

What I want to do is disable the console output mainly for the mongodb image because it has a lot of output, so that I can see all the output from my flask unit tests without scrolling up and visually sorting through the mongodb stuff that I don't need to see after running docker-compose up. My docker compose yaml looks like this:

 postgres:
   image: postgres:9.6.1
   ports:
     - '5432:5432'
   volumes:
     - ~/.docker-volumes/docker-login/postgresql/data:/var/lib/postgresql/data

 redis:
   image: redis:3.0
   ports:
     - '6379:6379'
   volumes:
     - ~/.docker-volumes/docker-login/redis/data:/var/lib/redis/data

 mongo:
   image: mongo:latest
   ports:
     - '27017:27017'
   volumes:
     - ~/.docker-volumes/docker-login/mongodb/data:/var/lib/mongo/data

 workspace:
   build: .
   volumes:
     - .:/workspace
     - ./logs:/workspace/logs
   ports:
     - '5000:5000'
   links:
     - mongo
     - postgres
     - redis
   tty: true
   entrypoint:
     - bash
     - workspace/entrypoint.sh
2 Answers

From official documentation you can do:

version: "3.7"
services:
  some-service:
    image: some-service
    logging:
      driver: "none"

This works for me!

I would suggest running docker-compose up -d

and then access only those container logs you are wanting to see:

docker-compose logs -f <container_id\name>

Logs Documentation

Related