-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Provide metadata to identify a container from inside #6192
Comments
Easy enough to do. Only 2 real questions in my mind are:
|
Initial suggestions on the first one: Full ID and name of the container, image it was created from (if applicable). Maybe whether we are rootless? |
Here is how a typical /.flatpak-info looks:
I think, somewhat in order of importance, what most people are interested in is:
Beyond this, most things are similar to on the host system and you if you want to look for a feature or option you can just use whatever probing code you would use on the host. |
We currently create /run/.containerenv with no data in it. We could populate these files with content, but don't we really need a standard location for returning this content between podman, buildah, cri-o, flatpack (bubblewrap?) |
The Flatpack example seems to be TOML, which seems like it would work pretty well as well |
Ah, nevermind, it's not - no quoting, etc... I need more coffee |
@ParkerVR PTAL |
A friendly reminder that this issue had no activity for 30 days. |
@ParkerVR Any progress? |
I suggest to create a package in common @lsm5 could you do this (after bug week)? The reasoning to pack it into c/common is to allow other tools to use it and semi-standardize on a format. Once we a PR draft is open, we can start bikeshedding on the format and fields. |
If someone wants to open a PR in containers/common to kick this off, it would be great. I like name value pares since it makes it easier to process from bash. I would worry about information leakage, so we need to be careful about what goes into this file. |
A friendly reminder that this issue had no activity for 30 days. |
Ok no one has stepped forward for the past month on this. But what kind of data do we want. Looking at @alexlarsson Data, I am not sure how much of this makes sense. Are you looking for more info then the following. There is a slippery line where we don't want to leak too much information into the container for hacker purposes.
|
@rhatdan I think that, for most cases, you want/need to know which image (name, tag and digest) you are in. So, the info you propose should be more than enough. I mean this for general purposes and cases like toolbox users. Some other use cases, as Flatpak, probably would need more info, but they already have their ways and it might be too much info for more general cases. |
Yes, the container name and ID, and the image name and ID are the most important, I think. As for the engine, would it be the version of Podman that started the container? Or the one that called |
@debarshiray What do you think if we only give this information out in --privileged mode? Or have a config flag and containers.conf to say whether we reveal it. Some engineers are raising concerns about the information leak, being a vector to attach the system. |
Toolbox already uses |
We have been asked to leak some information into the container to indicate: * The name and id of the container * The version of podman used to launch the container * The image name and ID the container is based on. * Whether the container engine is running in rootless mode. Fixes: containers#6192 Signed-off-by: Daniel J Walsh <[email protected]>
/kind feature
Description
Sometimes I come across people who are looking for ways to identify their Toolbox containers while sitting inside them. One use-case is to customize the shell prompt, just like one of those fancy Git prompts that identify the current branch and such.
I don't know what the ideal format would be.
Flatpak puts a INI-style file with stanzas at
/.flatpak-info
that describes the container. JSON is another option, but it isn't something that you can parse using the barebones POSIX shell utilities.Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):The text was updated successfully, but these errors were encountered: