Add info invalid references (#17224)

* Add info invalid references

The example shows a configuration that would raise a invalid image reference error if the environment variable for the image is set to an empty string or is not set at all.

Also the code format ticks included the period.

#17192

A warning was added to highlight the incorrect configuration and the ticks now exclude the period.

* Apply suggestions from code review

---------

Co-authored-by: Allie Sadler <102604716+aevesdocker@users.noreply.github.com>
This commit is contained in:
Kibubu 2023-05-09 15:00:05 +02:00 committed by GitHub
parent f3b2544ac7
commit e06245ea95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -109,7 +109,11 @@ db:
When you run `docker compose up` with this configuration, Compose looks for the `POSTGRES_VERSION` environment variable in the shell and substitutes its value in. For this example, Compose resolves the image to `postgres:9.3` before running the configuration.
If an environment variable is not set, Compose substitutes with an empty string. In the example above, if `POSTGRES_VERSION` is not set, the value for the image option is `postgres:.`
If an environment variable is not set, Compose substitutes with an empty string. In the example above, if `POSTGRES_VERSION` is not set, the value for the image option is `postgres:`.
> **Note**
>
> `postgres:` is not a valid image reference. Docker expects either a reference without a tag, like `postgres` which defaults to the latest image, or with a tag such as `postgres:15`.
> **Important**
>