builder: rephrase ENV section, remove examples for ENV key value without '='#2741
builder: rephrase ENV section, remove examples for ENV key value without '='#2741thaJeztah merged 3 commits intodocker:masterfrom
Conversation
…out '='
The `ENV key value` form can be ambiguous, for example, the following defines
a single env-variable (`ONE`) with value `"TWO= THREE=world"`:
ENV ONE TWO= THREE=world
While we cannot deprecate/remove that syntax (as it would break existing
Dockerfiles), we should reduce exposure of the format in our examples.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Codecov Report
@@ Coverage Diff @@
## master #2741 +/- ##
=======================================
Coverage 57.15% 57.15%
=======================================
Files 297 297
Lines 18657 18657
=======================================
Hits 10663 10663
Misses 7132 7132
Partials 862 862 |
silvin-lubecki
left a comment
There was a problem hiding this comment.
LGTM, with just one comment
| RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y ... | ||
| ``` | ||
|
|
||
| Or using [`ARG`](#arg), which is not persisted in the final image: |
There was a problem hiding this comment.
I don't think we should enforce that, I consider it more a trick than a real feature.
There was a problem hiding this comment.
It's a build-time argument/option, so I think it's a valid use, not different from, e.g.
ARG VERSION=v1.0.0
RUN install foo-${VERSION}There was a problem hiding this comment.
To me the ARG semantic is to expose a customization point to the user, not to set an env var only during build step. So yes it works, but should we advertise it in the doc?
docs/reference/builder.md
Outdated
| > ``` | ||
| > | ||
| > The alternative syntax is supported for backward compatibility, but discouraged | ||
| > for the reasons outlined above. |
There was a problem hiding this comment.
and may be removed in a future version.
There was a problem hiding this comment.
Opened #2743 if we want to officially deprecate
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
098e3c2 to
0eb3cfd
Compare
The endorsed format for specifying environment variables in Dockerfile is: ENV key="value" The old format is deprecated as of 2020 [1][2]. Fix our formatter to follow correct format. 1: docker/cli#2743 2: docker/cli#2741 Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
relates to moby/buildkit#1692 (comment)
- What I did
The
ENV key valueform can be ambiguous, for example, the following definesa single env-variable (
ONE) with value"TWO= THREE=world":ENV ONE TWO= THREE=worldWhile we cannot deprecate/remove that syntax (as it would break existing
Dockerfiles), we should reduce exposure of the format in our examples.
- A picture of a cute animal (not mandatory but encouraged)