1

It's possible that I may be blind or stupid but I have a fairly simple problem for which, aside form not being able to accurately describe it in the title, I wasn't able to find a straightforward solution online.

I have a docker-compose.yml describing about 10 services that generally need each other.

On docker-compose up I'm left attached to running containers, which I generally need, to follow logged stuff in real time.

However, for only 2 of those containers, I do not want this to happen (they are stuff like rabbitmq and elasticsearch and I'm not interested in what they have to say unless they fail altogether).

Is it possible to run docker-compose up and somehow exclude those 2? Rather than preventing them from logging stuff, I'm wondering if there's a way to just not attach to them. I know I can just detach and manually attach to the 8 left, but that's not very convenient.

Thanks!

2

Run ther containers without attaching:

docker-compose up -d

And then use the logs subcommand to only get the relevant logs:

docker-compose logs -f service1 service2 service3

-f will live tail the logs.

2
  • yes, it seems this is the way. I was hoping to be able to do it all in one place rather than manually select the services to tail after wards. thanks! – Andrei Dascalu Jan 20 '18 at 14:25
  • At least for me, if I run that command in the "right directory" without naming services on the command line, I get the (only) service log automatically. – Ryan Pavlik Feb 7 '19 at 21:08
0

Wouldn't docker-compose up -d solve your issue as it will start the containers as daemons?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.