Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions content/manuals/compose/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)