-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ARG instead of ENV for variables only used for labels #240
Comments
Thanks for the report. I can understand the logic behind it but I am very much against this change. |
This sounds like a change that is aimed at OSBS builds (where these arguments are always available?) so one note from me on that point is, we are no longer building Fedora-based images in Fedora's OSBS system. |
ARG will use the value set by default. No need to pass values for each build: https://docs.docker.com/engine/reference/builder/#default-values This will not invalidate layers for each builds. Only the first time when we make the change. The goal of this change is to avoid setting environment variables that are not needed by the application: containers/toolbox#188 I'm trying to look at all Fedora containers to remove those variables from the containers environment as they are not needed to set labels.
This is the reverse: OSBS uses labels to figure out what's in the container, not the ENV or ARG vars. It does not use ARG right now so this change is not for that. OSBS built containers also don't need ENV and can use ARG instead. I'm pushing for that in containers/docs#15 |
If you don't like the ARG usage, you can also directly inline the values in the labels, that should work just fine. |
Thanks for the detailed explanation! Played a bit with No priority on our side to work on this in the near future, but we welcome PRs if you want to get this change in sooner that we are able to get to it. |
Great, will make PRs once I have the changes merged upstream. |
The variables in https://github.com/sclorg/nginx-container/blob/master/1.22/Dockerfile.fedora#L11..L15 are only used to set LABELS a fe lines below and should not "leak" inside the container images.
Using
ARG
instead ofENV
will make those variables only available during the build and not built into the image default environment.Note: This also applies to all other container images in this org. I'm only reporting this once.
See containers/docs#15
The text was updated successfully, but these errors were encountered: