I have the following services:
If I do the following:
docker compose --profile support up
It will launch ServiceA
and ServiceB
, and that's what I would expect it to do.
However, if I run:
docker compose stop
It just returns without any response.
If I run docker compose ps
I can see that ServiceA and ServiceB are still running.
I have to explicitly state the profile like so:
docker compose --profile support stop
My question is two fold:
default
profile, why do I have to specify a profile?docker compose stop
simply stop all services that are running?Is this a bug or a feature?
Service A/B are part of the default profile, why do I have to specify a profile?
A profile named "default" is not a default profile. Default profile is like an unassigned profile.
why shouldn't docker compose stop simply stop all services that are running?
It will stop all services with unassigned profile. To stop default profile you can use docker compose --profile default stop
.
Actually I just tested that an empty string profile is equal to an unassigned profile, so you use that instead of a profile named default.
---
services:
test:
image: busybox
command: sleep infinity
profiles: [frontend, '']