I have many similar services in my docker-compose.yml
which can be split in two groups where each application depends on the corresponding proxy. In order to manage them more easily I added profiles like so:
services:
# proxies
proxy-one:
image: example/proxy
profiles: [proxy-one, proxy, one, all]
...
# applications
application-one:
image: example/application
profiles: [application-one, application, one, all]
depends_on:
- proxy-one
...
Now I can manage them using these profiles without need to specify each particular service, like:
docker compose --profile proxy up -d
or
docker compose --profile one restart
or
docker compose --profile all down
But I can’t view logs for applications only in the same way using profiles because they have dependencies:
$ docker compose --profile application logs
service "application-one" depends on undefined service "proxy-one": invalid compose project
Is there any way to leverage profiles for viewing logs as well?
Or I still need to list each service individually?
I understand why this dependency is important for other commands like start/stop etc., but for logs it defeats the purpose.