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

@ -84,14 +84,12 @@ services:
You can override the environment file path using a command line argument `--env-file`.
### 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
appropriately, for example, `.env.ci`, `.env.dev`, `.env.prod`. Passing the file path is
done using the `--env-file` option:
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:
```console
$ docker compose --env-file ./config/.env.dev up
$ docker compose --env-file ./config/.env.dev up
```
This file path is relative to the current working directory where the Docker Compose
@ -115,7 +113,7 @@ services:
The `.env` file is loaded by default:
```console
$ docker compose convert
$ docker compose convert
version: '3'
services:
web:
@ -125,7 +123,7 @@ services:
Passing the `--env-file` argument overrides the default file path:
```console
$ docker compose --env-file ./config/.env.dev config
$ docker compose --env-file ./config/.env.dev config
version: '3'
services:
web:
@ -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 same variable in the shell in which Compose is run.
When you set the same environment variable in multiple files, here's the
priority used by Compose to choose which value to use:
1. Compose file
2. Shell environment variables
3. Environment file
4. Dockerfile
5. Variable is not defined
>**Note**
>
> 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.
You can find this precedence rule and a table illustrating how interpolation works in the [Environment variables precedence](../compose/envvars-precedence.md) page.
In the example below, we set the same environment variable on an Environment
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 |
|:-:|:--------------------------:|:-----------------------------:|:---------------------------------:|:------------:|:-------------:|:------------:|:-----------------:|
| 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` |
| 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` |
| 5 | `TAG=$TAG:-1.2` | Unset | Unset | `TAG` | `TAG=1.6` | - | `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` | Unset | `TAG=1.6` |
| 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` |
| 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` |
| 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` |
| 14| - |**`TAG=1.8`** | - | - | `TAG=1.6` | `TAG=1.4` | `TAG=1.8` |
| 15| - | - | `TAG=1.7` | - | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` |
| 16| - | - | `TAG=1.7` | - | `TAG=1.6` | `TAG=1.4` | `TAG=1.4` |
| 14| Unset |**`TAG=1.8`** | Unset | Unset | `TAG=1.6` | `TAG=1.4` | `TAG=1.8` |
| 15| Unset | Unset | `TAG=1.7` | Unset | `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:
* Image - `ENV` directive in the Dockerfile