问题
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
回答1:
I would suggest to run docker compose up -d
and then access only those container logs you are wanting to see
回答2:
From official documentation you can do:
version: "3.7"
services:
some-service:
image: some-service
logging:
driver: "none"
This works for me!
来源:https://stackoverflow.com/questions/53806256/docker-compose-suppress-mongodb-output