Skip to content
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

RFE: touch a file to make it easy to tell we're containerized #529

Closed
jlebon opened this issue Mar 22, 2018 · 11 comments
Closed

RFE: touch a file to make it easy to tell we're containerized #529

jlebon opened this issue Mar 22, 2018 · 11 comments
Assignees
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@jlebon
Copy link
Contributor

jlebon commented Mar 22, 2018

/kind feature

Description

AFAICT, there isn't a file like /.dockerenv to make it easy to tell we're in a container. Can we add something like /run/podman-container?

@mheon
Copy link
Member

mheon commented Mar 22, 2018

This seems like an easy enough thing to do

@mheon mheon self-assigned this Mar 22, 2018
@TomSweeneyRedHat
Copy link
Member

but /.containerenv or some such?

@jlebon
Copy link
Contributor Author

jlebon commented Mar 22, 2018

That sounds OK too. I find /run nicer to indicate the ephemeral nature of it though that's mostly personal preference. :)

@TomSweeneyRedHat
Copy link
Member

/run/.containerenv would be fine by me too. My main thing was to not include the d-word....

@mheon
Copy link
Member

mheon commented Mar 22, 2018

Is there anything we should look into including in the file that would be helpful, besides its existence? Podman version, potentially?

@jlebon
Copy link
Contributor Author

jlebon commented Mar 22, 2018

Hmm, how about we just leave it empty for now? Adding things later on if we really want would be a mostly backwards compatible change.

@rhatdan
Copy link
Member

rhatdan commented Mar 23, 2018

Will this work with readonly containers? Should the file be read-only, should we make sure the file does not end up in an image? Putting the file in /run, would be my preferred mechanism to. Adding the version of the tool that created the file inside buildah-1.13 or podman-0.3.3

@nalind
Copy link
Member

nalind commented Mar 23, 2018

If we add a file, like dockerd does, but give it a different name, then we're not reducing the amount of work required for anyone. systemd suggests setting container in the environment to a short value that identifies the implementation. Would that work for the use case?

@mheon
Copy link
Member

mheon commented Mar 23, 2018

@baude suggested an environment variable would be good to set in addition to the file. It would be easy enough to add both.

@rhatdan
Copy link
Member

rhatdan commented Mar 23, 2018

Yes systemd like container=podman or container=buildah to be set.

@mheon
Copy link
Member

mheon commented Mar 23, 2018

Fixed in #533

@mheon mheon closed this as completed Mar 23, 2018
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

5 participants