You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NAME and VERSION leak into toolbox container env #188
I noticed that envvar for ENV NAME=fedora-toolbox VERSION=30 leak into the toolbox environment.
I am not sure if this is desirable: eg NAME affects changelog entry generation in Emacs rpm-spec-mode. And probably having VERSION in the container is not that useful either.
Yeah, those variables are exported by Podman. It always felt odd that they aren't namespaced. I wonder if Docker does the same, and so it's done for compatibility.
I wish I could transfer this to libpod. Doesn't look like I have the necessary permissions for that. :(
@juhp could you please (re)file this against libpod ? We could do something to suppress these variables, but they come directly from Podman, so might be better to at least discuss it a bit first. I have no idea why such generically named and non-namespaced variables were chosen in the first place.
@debarshiray, I guess we could unset the env vars when the container is being initialized. That way we keep them in the Dockerfiles but they will not cause problems during runtime.
I guess we could unset the env vars when the container is
being initialized. That way we keep them in the Dockerfiles
but they will not cause problems during runtime.
The NAME and VERSION environment variables make their way into the toolbox containers from their corresponding images, and are part of the containers' metadata. See:
$ podman inspect --type container <container>
We could somehow unset the variables right before spawning the interactive shell inside the container. However, that would deepen the voodoo that we perform when launching the shell.
A cleaner alternative might be to block the environment variables from getting leaked into the container from the image, but I don't see an obvious way to do that.
Thanks for the answer.
It looks like the only clean solution would be to change OSBS to rely on labels (which are actually designed for this type of metadata).
@debarshiray I might be wrong on this but by looking at the guidelines, looks like there is a requirement for the right labels to be present by fedora build system and not the env vars themeselves ?
Could the env vars in Containerfile be converted to ARGS instead or change them to TOOLBOX_NAME and TOOLBOX_VERSION which would be quite useful to have inside?
Activity
debarshiray commentedon Jun 7, 2019
Yeah, those variables are exported by Podman. It always felt odd that they aren't namespaced. I wonder if Docker does the same, and so it's done for compatibility.
debarshiray commentedon Jan 10, 2020
I wish I could transfer this to
libpod. Doesn't look like I have the necessary permissions for that. :(@juhp could you please (re)file this against
libpod? We could do something to suppress these variables, but they come directly from Podman, so might be better to at least discuss it a bit first. I have no idea why such generically named and non-namespaced variables were chosen in the first place.debarshiray commentedon Jan 10, 2020
Oh wait, they actually come from the Dockerfile for the
fedora-toolboximages.debarshiray commentedon Jan 10, 2020
They are mandated by the Fedora guidelines.
debarshiray commentedon Jan 10, 2020
On closer reading, it doesn't look like the guidelines actually require them, but they are part of the example Dockerfile snippets.
cverna commentedon Jan 10, 2020
So from a quick look at OSBS it seems that these labels are used to populate some data in koji post build. I don't think we can remove them.
I ll look into more details next week if there is a work around.
debarshiray commentedon Jan 10, 2020
Thanks for clarifying that, @cverna !
debarshiray commentedon May 13, 2020
@cverna confirmed in
#fedora-containerson Freenode thatNAMEandVERSIONreally do need to be present in the Dockerfile.martymichal commentedon Jun 13, 2020
@debarshiray, I guess we could unset the env vars when the container is being initialized. That way we keep them in the Dockerfiles but they will not cause problems during runtime.
Jmennius commentedon Jun 25, 2020
@debarshiray Can you clarify why exactly are they required?
Should we have them in non-Fedora images?
debarshiray commentedon Jun 25, 2020
The
NAMEandVERSIONenvironment variables make their way into the toolbox containers from their corresponding images, and are part of the containers' metadata. See:We could somehow unset the variables right before spawning the interactive shell inside the container. However, that would deepen the voodoo that we perform when launching the shell.
A cleaner alternative might be to block the environment variables from getting leaked into the container from the image, but I don't see an obvious way to do that.
debarshiray commentedon Jun 25, 2020
As @cverna mentioned, they are needed by the Fedora build system.
I don't think you need them in non-Fedora images.
Jmennius commentedon Jun 25, 2020
Thanks for the answer.
It looks like the only clean solution would be to change OSBS to rely on labels (which are actually designed for this type of metadata).
debarshiray commentedon Aug 28, 2020
Closing.
We can revisit this once the Fedora build system no longer needs
NAMEandVERSION.JayDoubleu commentedon Jan 16, 2022
@debarshiray I might be wrong on this but by looking at the guidelines, looks like there is a requirement for the right labels to be present by fedora build system and not the env vars themeselves ?
https://github.com/containerbuildsystem/atomic-reactor/blob/bdf5ecf52db1a30a5db135d12b51a488c04ebe29/atomic_reactor/plugins/pre_bump_release.py#L253..L266
Could the env vars in Containerfile be converted to ARGS instead or change them to
TOOLBOX_NAMEandTOOLBOX_VERSIONwhich would be quite useful to have inside?debarshiray commentedon Feb 16, 2023
Just now @travier brought this up in containers/docs#15
Unfortunately, I am not an expert in Fedora's OCI image building pipeline. I
mostly follow what the maintainers of the pipeline mandate. :)
images: Don't leak NAME and VERSION into the Toolbx container