-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Fix COPY --from with userns and non zero uid/gid files #38823
Conversation
Fixes moby#34645 Signed-off-by: Segev Finer <segev@codeocean.com>
ping @estesp @tonistiigi PTAL |
Codecov Report
@@ Coverage Diff @@
## master #38823 +/- ##
==========================================
- Coverage 36.49% 36.45% -0.04%
==========================================
Files 613 613
Lines 45886 45886
==========================================
- Hits 16746 16728 -18
- Misses 26847 26860 +13
- Partials 2293 2298 +5 |
@segevfiner wondering; would #38599 also solve this situation? |
This doesn't seem to be the correct solution. #38599 is probably a better approach for this as we don't actually need to remap files between stages. |
That would be rather strange actually since this still needs to map from host to container ID in that case. This should only break if it is used somewhere to copy files from container to host. But if there is a better solution, than sure, merge that instead, this is just a quick solution I came up with and haven't throughly tested that it doesn't break anything, though I did run the test suite and tested that it fixes the issue. |
I started the userns suite to show the failing ones https://jenkins.dockerproject.org/job/Docker-PRs-userns/14871/console #38599 was merged. Could you test if it fixes all of your issues as well. |
I tried it with latest master @ 29de017, and the issue still happens. Do feel free to try using the I guess that means we still need a fix here, we need to make |
The https://bitbucket.org/site/master/issues/17241/copying-files-in-multistage-docker |
I'll have a go at reproducing the original issue this PR is trying to fix. Not sure if it is still a thing that needs to be fixed after #38599 has been merged. |
I'm able to reproduce the error with docker-ce 19.03.4 legacy builder, but the issue that this PR is trying to fix does not exist with docker-ce 19.03.4 enabled with buildkit builds. I'd recommend using docker build with buildkit builds to work around this issue since that is what the docker engine is migrating towards as the default in the future. This PR should be closed. |
Closing as this doesn't seem to be the correct solution based on #38823 (comment) . Lets continue tracking the legacy builder problem in the issue #34645. Reopen if you have an updated solution. |
- What I did
Fixed using
COPY --from
with userns enabled and files that have non-zero UID/GID.- How I did it
Modified
remapIDs
to map from host to container instead of container to host.- How to verify it
Need to make sure there isn't a code path that does need this to map from container->host, as than I'm unsure how to fix this and it will obviously break that.
The described
Dockerfile
can be made into a test, but I was unsure on where to place it.- Description for the changelog
Fix
COPY --from
with userns and non-zero UID/GID files.Fixes #34645