From ae59cf135d4314a048681b567387d543a230f467 Mon Sep 17 00:00:00 2001 From: Guillaume Lours <705411+glours@users.noreply.github.com> Date: Wed, 19 Mar 2025 11:01:26 +0100 Subject: [PATCH] correct compose down example with profile The down command used with profile will stop the services with a given profile but also all the services without any profiles Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com> --- content/includes/compose/profiles.md | 2 +- content/manuals/compose/how-tos/profiles.md | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/content/includes/compose/profiles.md b/content/includes/compose/profiles.md index 03802cedba14..b019bde24285 100644 --- a/content/includes/compose/profiles.md +++ b/content/includes/compose/profiles.md @@ -1 +1 @@ -Profiles help you adjust your Compose application for different environments or use cases by selectively activating services. Services can be assigned to one or more profiles; unassigned services start by default, while assigned ones only start when their profile is active. This setup means specific services, like those for debugging or development, to be included in a single `compose.yml` file and activated only as needed. +Profiles help you adjust your Compose application for different environments or use cases by selectively activating services. Services can be assigned to one or more profiles; unassigned services start/stop by default, while assigned ones only start/stop when their profile is active. This setup means specific services, like those for debugging or development, to be included in a single `compose.yml` file and activated only as needed. diff --git a/content/manuals/compose/how-tos/profiles.md b/content/manuals/compose/how-tos/profiles.md index 416d397d3d16..9f745510b94b 100644 --- a/content/manuals/compose/how-tos/profiles.md +++ b/content/manuals/compose/how-tos/profiles.md @@ -175,7 +175,7 @@ $ docker compose --profile dev up phpmyadmin $ COMPOSE_PROFILES=dev docker compose up phpmyadmin ``` -## Stop specific profiles +## Stop application and services with specific profiles As with starting specific profiles, you can use the `--profile` [command-line option](/reference/cli/docker/compose.md#use--p-to-specify-a-project-name) or use the [`COMPOSE_PROFILES` environment variable](environment-variables/envvars.md#compose_profiles): @@ -187,7 +187,7 @@ $ docker compose --profile debug down $ COMPOSE_PROFILES=debug docker compose down ``` -Both commands stop and remove services with the `debug` profile. In the following `compose.yaml` file, this stops the services `db` and `phpmyadmin`. +Both commands stop and remove services with the `debug` profile and services without a profile. In the following `compose.yaml` file, this stops the services `db`, `backend` and `phpmyadmin`. ```yaml services: @@ -207,6 +207,15 @@ services: image: mysql ``` +if you only want to stop the `phpmyadmin` service, you can run +```console +$ docker compose down phpmyadmin +``` +or +```console +$ docker compose stop phpmyadmin +``` + > [!NOTE] > > Running `docker compose down` only stops `backend` and `db`.