Anonymous - 2019-03-11

Originally posted by: ulyssessouza

Hello @GiovanniPaoloGibilisco.
What you can do is separating the services in different files and using multiple -f flags to combine them.
For example:
With 2 files:

$ cat docker-compose1.yml
version: '2'
services:
    first:
        image: nginx
    second:
        image: nginx
$ cat docker-compose2.yml
version: '2'
services:
    third:
        image: nginx
    fourth:
        image: nginx

This opens the possibility of starting all with:

$ docker-compose -f docker-compose1.yml -f docker-compose2.yml up -d

And to stop just the third and fourth, this can be done by:

$ docker-compose -f docker-compose2.yml stop

Like this, you can define your groups using different files.
Please, let me know if that covers your use case.