-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Is there a way to --strip-components with ADD #4136
Comments
That'd be nice. |
It would be interesting to see a I think you could probably simulate it via multi-stage build, but that'll adjust all ownership to
I'd really recommend re-packing your rootfs tarball to be a strict rootfs without that additional layer (even if that repacking only happens in the context of the Docker image repository). |
I know we discussed that situation at some point, but don't recall if we created a tracking issue for that, because I think we should have an option to preserve ownership and permissions when copying between stages. I can see a lot of use-cases where a build-stage would perform all the preparations (extracting, compiling, setting permissions), and a final build-stage would only Just a bit worried of implementing everything that tar does (and trying to match the exact behaviour). |
Small update on this part; since moby/moby#38599 (and when using buildkit, since #809), ownership should be preserved when using That said, there's still enhancements to be made, such as moby/moby#38710 / moby/moby#35639, and moby/moby#35280 |
It's been a couple of years since this question was asked FROM scratch AS rootfs
ADD rootfs.tar.gz /
FROM scratch AS install
COPY --from=rootfs /root.x86_64 / |
I don't think there's updates on this one, but admitted, given that the alternatives with multi-stage builds aren't "too horrible", I don't think it got on the top of the priority list 😅.
As you're copying to a Given that development of the Dockerfile syntax has fully moved to the BuildKit repository (where the definition of the syntax now lives), let me also move this ticket to that repository. |
A server is hosting a rootfs-wrapper.tar.xz file which instead of having this structure:
is having a wrapper directory
With regular shell we can do:
curl -O http://site/rootfs-wrapper.tar.xz tar -xf rootfs.tar.xz --strip-components=1 -C .
How do we do that with
scratch
docker where we don't have access totar
andcurl
and viable option is to useADD
commandit builds fine with
docker build -t simple-build .
, but fails to rundocker run -it simple-build
gives:If we use
rootfs.tar.xz
withoutwrapper/
then docker run works without modifying the docker.I tried setting
CMD ["/wrapper/bin/sh"]
in docker as well but same result.Is there a way to make
ADD
command strip components of tar?The text was updated successfully, but these errors were encountered: