ENGDOCS-2203 (#20784)

* ENGDOCS-2203

* vale fix

* Update content/manuals/compose/profiles.md
This commit is contained in:
Allie Sadler 2024-09-10 08:14:26 +01:00 committed by GitHub
parent 52a87f6bb0
commit c59d8a7848
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 38 additions and 2 deletions

View File

@ -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)