Originally created by: GiovanniPaoloGibilisco
Managing complex docker-compose files with multiple services and dependencies sometime I would like to start only a subset of them. Currently I issue commands like:
docker-compose up -d elasticsearch logstasg kibana database serviceA serviceB...
or
docker-compose up -d; docker-compose stop prometheus serviceB ....
Working by addition is I need a few services or subtraction if I need more.
I think it would be useful to be able to specify in the compose file some sort of profile (e.g. minimal, full, databases, logging..) and let docker-compose spawn those services (and related dependencies) that share the profile.
Probably using labels for this is a more general way of handling this kind of situations.
What I have in mind is something like:
docker-compose up -d --profile minimal
then all services with label profile containing minimal would be created. In such a scenario the label profile should contain a list of values more than a single one.
A more general solution would be:
docker-compose up -d --labels profile=minimal
so that users are free to use labels as they like and the compose just expose a filter on services to start.
Originally posted by: ulyssessouza
Hello @GiovanniPaoloGibilisco.
What you can do is separating the services in different files and using multiple
-fflags to combine them.For example:
With 2 files:
This opens the possibility of starting all with:
And to stop just the third and fourth, this can be done by:
Like this, you can define your groups using different files.
Please, let me know if that covers your use case.