-
Notifications
You must be signed in to change notification settings - Fork 758
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
Add --unsetenv option to buildah commit and build #3611
Conversation
**--unsetenv** *env* | ||
|
||
Unset environment variables from the final image. | ||
|
||
**--userns** *how* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn’t $PATH the only use case? Thus thereis no need for a parameter to the --unsetenv command line option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think the PATH variable is the only use case and therefore this switch shall be called --unsetpathenv
without parameters.
The Containerfile specification, as far as I remember does not say that there is an implicit PATH variable, which this new command line parameter is supposed to disable. |
No, I believe if you base on top of a lower image, the new image will inherit the environment from the base image, If you want to remove those environment variables, this would come in handy. |
@@ -101,6 +101,10 @@ When --timestamp is set, the created timestamp is always set to the time specifi | |||
|
|||
Require HTTPS and verification of certificates when talking to container registries (defaults to true). TLS verification cannot be used when talking to an insecure registry. | |||
|
|||
**--unsetenv** *env* | |||
|
|||
Unset environment variables from the final image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have an example in the EXAMPLE section, ditto elsewhere.
Tests aren't hip and it looks like you need a rebase. In the tests, it would be good to define an ENVAR and then unset it rather than relying on PATH. |
Has somebody ever come to the idea to remove variables, set by lower images? I think the only use case for this change is to suppress the implicit PATH when interpreting a |
Since ubi8-init defines PATH and container, you see both defined in the new image.
Images can have multiple environment variables defined within them, This way a user can base an image off of a lower image, and remove environment variables. |
How exactly does Containerfile’s FROM (non-scratch) work? Does it unfold the base image, add the current Container-file instruction and create a new images, so that the new image is self-contained and when moved to a new system, the inital base image does not have to be downloaded? Or creating |
Ah, I see there is a "org.opencontainers.image.base.name" field in the "schemaVersion":2,"config":{"mediaType":"application/vnd.oci.image.config.v1+json" object. I have:
so the Alpine image (L/ directory) definition contains I have built buildah on the rhatdan:unsetenv branch. |
Podman will add the PATH environment itself, if the image does not contain it. (Docker will too, I believe.) |
This option will allow users to remove environment variables from the final image. Fixes: containers#3512 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
This option will allow users to remove environment variables from the
final image.
Fixes: #3512
Signed-off-by: Daniel J Walsh dwalsh@redhat.com
What type of PR is this?
What this PR does / why we need it:
How to verify it
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?