diff --git a/content/manuals/compose/profiles.md b/content/manuals/compose/profiles.md index e9bcff0ba8f5..a9416d27e350 100644 --- a/content/manuals/compose/profiles.md +++ b/content/manuals/compose/profiles.md @@ -58,8 +58,8 @@ $ docker compose --profile debug up $ COMPOSE_PROFILES=debug docker compose up ``` -The above commands would both start your application with the `debug` profile enabled. -In the example, `compose.yml` file above, this starts the services `backend`, +Both commands start the services with the `debug` profile enabled. +In the previous `compose.yml` file, this starts the services `db` and `phpmyadmin`. ### Start multiple profiles @@ -173,6 +173,42 @@ $ docker compose --profile dev up phpmyadmin $ COMPOSE_PROFILES=dev docker compose up phpmyadmin ``` +## Stop specific profiles + +As with starting specific profiles, you can use the `--profile` [command-line option](reference/index.md) or +use the [`COMPOSE_PROFILES` environment variable](environment-variables/envvars.md#compose_profiles): + +```console +$ docker compose --profile debug down +``` +```console +$ COMPOSE_PROFILES=debug docker compose down +``` + +Both commands stop and remove services with the `debug` profile. In the following `compose.yml` file, this stops the services `db` and `phpmyadmin`. + +```yaml +services: + frontend: + image: frontend + profiles: [frontend] + + phpmyadmin: + image: phpmyadmin + depends_on: [db] + profiles: [debug] + + backend: + image: backend + + db: + image: mysql +``` + +> [!NOTE] +> +> Running `docker compose down` only stops `backend` and `db`. + ## Reference information [`profiles`](/reference/compose-file/services.md#profiles)