-
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
--userns=auto for podman build is generating different uid/gid for each ephemeral container #18031
Comments
I don't see why there is that expectation. If you use The |
I believe we should make the same userns for the length of the build. Not have it change for each run line. |
we'd need to create a dummy container to keep that user namespace busy and join it from other containers, it is kind of messy for something that looks like a minor detail. To me it still feels like an implementation detail, once you specify If you want to use the same mapping, you can force using the same container with |
Thanks. |
I'd prefer to not change the semantic of Performance issues with If you really want that semantic, you can still handle it manually:
|
Why not just bake that semantics into podman build? I guess we can live with this as long as things like the ability to use content from one run command into a second run command. |
One other issue with this is that we will use up the user namespaces quicker. So if I have a container with 10 run lines, will it allocate and retain 10 ranges until the build is complete? In rootless mode this could cause issues with users running out of ranges of UID mappings. |
that seems like another issue, I don't see why we wouldn't delete the container as soon as it is not needed anymore.
what other problems wouldn't be solved with idmapped to share volumes? A problem I see with having a single user namespace is that we will have less flexibility in choosing the right size with files that use multiple FROM statements: e.g. let's create an image like the following (
Now the default size of 1024 IDs won't be enough:
There are still corner cases that are not covered when we start mixing and picking files from different layers, but picking a single size will make this worse. How would we pick the size? Should we scan the entire file and apply the heuristic to each
|
Ok, I guess I am thinking of this incorrectly? If the From lines are creating containers, as opposed to the run commands. So in general the different User Namespace is only for multi from builds. Then I go along with @giuseppe idea, as long as tools that copy content from a previous stage in the build to another. |
When we create a container we look at its image to decide how big the user namespace should be. In the example above we create one for The To not make things worse than they are now if we want to move to the logic of using a single user namespace, we will need to analyze the entire Containerfile first and pick the biggest size. This will complicate the logic and we will also need to expose more APIs from c/storage since it is not currently possible to run the heuristic to compute the userns size based on an image (unless we create a bunch of temporary containers and check their size after they are created). It complicates the logic a bit and I still don't see the benefit, sharing of content is possible with idmapped mounts. |
I think we stick to one user namespace per image (from line). |
I've found an issue while playing with With a file like:
I expect the user namespaces created to look like (there are different sizes depending on the image):
to honor each If we want to use one user namespace, then I think we need to pre-scan the Containerfile and analyze each @flouthoc is there any reason why we keep containers around after the |
This LGTM |
that is the behavior we have today and I think we should keep it without tying our hands to use only one user namespace. |
we can probably close this issue, for the discussion above, I don't think we can stick to a single user namespace for the build. Please reopen if you disagree with the decision |
Issue Description
UID/GID should be the same for each ephemeral container when using --userns=auto. Content shared across layers can be unavailable. Multistage is probably also affected, this will probably also improve building speed.
Steps to reproduce the issue
Steps to reproduce the issue
1.
podman build --userns=auto .
Describe the results you received
Describe the results you expected
Same namespace for all ephemeral containers / build context
podman info output
Podman in a container
No
Privileged Or Rootless
None
Upstream Latest Release
Yes
Additional environment details
Additional environment details
Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting
The text was updated successfully, but these errors were encountered: