Removing old rule and Unset cells in table

This commit is contained in:
dockertopia 2022-08-23 15:33:34 +01:00
parent 36490e3ed0
commit 9470c68d12
2 changed files with 17 additions and 23 deletions

View File

@ -86,9 +86,7 @@ You can override the environment file path using a command line argument `--env-
### Using the “--env-file” option ### Using the “--env-file” option
By passing the file as an argument, you can store it anywhere and name it By passing the file as an argument, you can store it anywhere and name it appropriately, for example, `.env.ci`, `.env.dev`, `.env.prod`. Passing the file path is done using the `--env-file` option:
appropriately, for example, `.env.ci`, `.env.dev`, `.env.prod`. Passing the file path is
done using the `--env-file` option:
```console ```console
$ docker compose --env-file ./config/.env.dev up $ docker compose --env-file ./config/.env.dev up
@ -201,14 +199,10 @@ $ docker compose run -e DEBUG web python console.py
The value of the `DEBUG` variable in the container is taken from the value for The value of the `DEBUG` variable in the container is taken from the value for
the same variable in the shell in which Compose is run. the same variable in the shell in which Compose is run.
When you set the same environment variable in multiple files, here's the >**Note**
priority used by Compose to choose which value to use: >
> When you set the same environment variable in multiple files, there's a precedence rule used by Compose when trying to resolve the value for the variable in question.
1. Compose file You can find this precedence rule and a table illustrating how interpolation works in the [Environment variables precedence](../compose/envvars-precedence.md) page.
2. Shell environment variables
3. Environment file
4. Dockerfile
5. Variable is not defined
In the example below, we set the same environment variable on an Environment In the example below, we set the same environment variable on an Environment
file, and the Compose file: file, and the Compose file:

View File

@ -17,22 +17,22 @@ Each row represents a scenario and each columns represents a context where you c
| # | `.env` file | `compose.yaml`:`env_file` key | `compose.yaml`:`environment` key | CMD | Image | OS | Resolved as | | # | `.env` file | `compose.yaml`:`env_file` key | `compose.yaml`:`environment` key | CMD | Image | OS | Resolved as |
|:-:|:--------------------------:|:-----------------------------:|:---------------------------------:|:------------:|:-------------:|:------------:|:-----------------:| |:-:|:--------------------------:|:-----------------------------:|:---------------------------------:|:------------:|:-------------:|:------------:|:-----------------:|
| 1 | `TAG=1.3` | Unset | Unset | - | `TAG=1.6` | `TAG=1.4` | `TAG=1.6` | | 1 | `TAG=1.3` | Unset | Unset | Unset | `TAG=1.6` | `TAG=1.4` | `TAG=1.6` |
| 2 | `TAG=1.3` | Unset | Unset | `TAG` | `TAG=1.6` | `TAG=1.4` | `TAG=1.3` | | 2 | `TAG=1.3` | Unset | Unset | `TAG` | `TAG=1.6` | `TAG=1.4` | `TAG=1.3` |
| 3 | `TAG=$TAG:-1.2` | Unset | Unset | `TAG` | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` | | 3 | `TAG=$TAG:-1.2` | Unset | Unset | `TAG` | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` |
| 4 | `TAG=$TAG:-1.2` | Unset | Unset | - | `TAG=1.6` | `TAG=1.4` | `TAG=1.6` | | 4 | `TAG=$TAG:-1.2` | Unset | Unset | Unset | `TAG=1.6` | `TAG=1.4` | `TAG=1.6` |
| 5 | `TAG=$TAG:-1.2` | Unset | Unset | `TAG` | `TAG=1.6` | - | `TAG=1.6` | | 5 | `TAG=$TAG:-1.2` | Unset | Unset | `TAG` | `TAG=1.6` | Unset | `TAG=1.6` |
| 6 | `TAG=$TAG:-1.2` | Unset | Unset | `TAG=1.5` | `TAG=1.6` | `TAG=1.4` | `TAG=1.5` | | 6 | `TAG=$TAG:-1.2` | Unset | Unset | `TAG=1.5` | `TAG=1.6` | `TAG=1.4` | `TAG=1.5` |
| 7 | `TAG=$TAG:-1.2` | Unset | `TAG` | - | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` | | 7 | `TAG=$TAG:-1.2` | Unset | `TAG` | Unset | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` |
| 8 | `TAG=$TAG:-1.2` | Unset | `TAG=1.7` | `TAG` | `TAG=1.6` | `TAG=1.4` | `TAG=1.7` | | 8 | `TAG=$TAG:-1.2` | Unset | `TAG=1.7` | `TAG` | `TAG=1.6` | `TAG=1.4` | `TAG=1.7` |
| 9 | `TAG=$TAG:-1.2` | Unset | `TAG=1.7` | `TAG=1.5` | `TAG=1.6` | `TAG=1.4` | `TAG=1.5` | | 9 | `TAG=$TAG:-1.2` | Unset | `TAG=1.7` | `TAG=1.5` | `TAG=1.6` | `TAG=1.4` | `TAG=1.5` |
| 10| `TAG=$TAG:-1.2` | Unset | `TAG` | `TAG` | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` | | 10| `TAG=$TAG:-1.2` | Unset | `TAG` | `TAG` | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` |
| 11| `TAG=$TAG:-1.2` | Unset | `TAG` | `TAG` | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` | | 11| `TAG=$TAG:-1.2` | Unset | `TAG` | `TAG` | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` |
| 12| `TAG=$TAG:-1.2` | `TAG=1.8` | - | **`TAG=1.5`** | `TAG=1.6` | `TAG=1.4` | `TAG=1.5` | | 12| `TAG=$TAG:-1.2` | `TAG=1.8` | Unset | **`TAG=1.5`** | `TAG=1.6` | `TAG=1.4` | `TAG=1.5` |
| 13| `TAG=$TAG:-1.2` | `TAG=1.8` | **`TAG=1.7`** | `TAG=1.5` | `TAG=1.6` | `TAG=1.4` | `TAG=1.7` | | 13| `TAG=$TAG:-1.2` | `TAG=1.8` | **`TAG=1.7`** | `TAG=1.5` | `TAG=1.6` | `TAG=1.4` | `TAG=1.7` |
| 14| - |**`TAG=1.8`** | - | - | `TAG=1.6` | `TAG=1.4` | `TAG=1.8` | | 14| Unset |**`TAG=1.8`** | Unset | Unset | `TAG=1.6` | `TAG=1.4` | `TAG=1.8` |
| 15| - | - | `TAG=1.7` | - | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` | | 15| Unset | Unset | `TAG=1.7` | Unset | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` |
| 16| - | - | `TAG=1.7` | - | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` | | 16| Unset | Unset | `TAG=1.7` | Unset | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` |
Description for each column: Description for each column:
* Image - `ENV` directive in the Dockerfile * Image - `ENV` directive in the Dockerfile