Update 15-profiles.md (#19400)

Replaced foo bar words to improve readability
This commit is contained in:
Éverton Inocêncio 2024-02-23 08:26:32 -04:00 committed by GitHub
parent ec779a59b2
commit 78925b2a84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 27 additions and 24 deletions

View File

@ -24,42 +24,45 @@ Compose returns an error.
```yaml
services:
foo:
image: foo
bar:
image: bar
web:
image: web_image
test_lib:
image: test_lib_image
profiles:
- test
baz:
image: baz
coverage_lib:
image: coverage_lib_image
depends_on:
- bar
- test_lib
profiles:
- test
zot:
image: zot
debug_lib:
image: debug_lib_image
depends_on:
- bar
- test_lib
profiles:
- debug
```
In the above example:
- If the Compose application model is parsed with no profile enabled, it only contains the `foo` service.
- If the profile `test` is enabled, the model contains the services `bar` and `baz`, and service `foo`, which is always enabled.
- If the profile `debug` is enabled, the model contains both `foo` and `zot` services, but not `bar` and `baz`,
and as such the model is invalid regarding the `depends_on` constraint of `zot`.
- If the profiles `debug` and `test` are enabled, the model contains all services; `foo`, `bar`, `baz` and `zot`.
- If Compose is executed with `bar` as the explicit service to run, `bar` and the `test` profile
- If the Compose application model is parsed with no profile enabled, it only contains the `web` service.
- If the profile `test` is enabled, the model contains the services `test_lib` and `coverage_lib`, and service `web`, which is always enabled.
- If the profile `debug` is enabled, the model contains both `web` and `debug_lib` services, but not `test_lib` and `coverage_lib`,
and as such the model is invalid regarding the `depends_on` constraint of `debug_lib`.
- If the profiles `debug` and `test` are enabled, the model contains all services; `web`, `test_lib`, `coverage_lib` and `debug_lib`.
- If Compose is executed with `test_lib` as the explicit service to run, `test_lib` and the `test` profile
are active even if `test` profile is not enabled.
- If Compose is executed with `baz` as the explicit service to run, the service `baz` and the
profile `test` are active and `bar` is pulled in by the `depends_on` constraint.
- If Compose is executed with `zot` as the explicit service to run, again the model is
invalid regarding the `depends_on` constraint of `zot`, since `zot` and `bar` have no common `profiles`
- If Compose is executed with `coverage_lib` as the explicit service to run, the service `coverage_lib` and the
profile `test` are active and `test_lib` is pulled in by the `depends_on` constraint.
- If Compose is executed with `debug_lib` as the explicit service to run, again the model is
invalid regarding the `depends_on` constraint of `debug_lib`, since `debug_lib` and `test_lib` have no common `profiles`
listed.
- If Compose is executed with `zot` as the explicit service to run and profile `test` is enabled,
profile `debug` is automatically enabled and service `bar` is pulled in as a dependency starting both
services `zot` and `bar`.
- If Compose is executed with `debug_lib` as the explicit service to run and profile `test` is enabled,
profile `debug` is automatically enabled and service `test_lib` is pulled in as a dependency starting both
services `debug_lib` and `test_lib`.
See how you can use `profiles` in [Docker Compose](../profiles.md).
See how you can use `profiles` in [Docker Compose](../profiles.md).