-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Support tar files for multi-arch images #325
Conversation
21ac36c
to
40d3e19
Compare
I am confused about how this fixes |
When the image dir contains an image index, this now bundles things up properly so that The layout of the tar file is an I've been using it to take an (My goal is to be able to |
I am more confused now. Could you please add an example to the examples folder to demonstrate how this works?
Could you elaborate a bit more on this? |
3df4641
to
e4db7bd
Compare
Sorry for not being clear! Hopefully the example will help. I've just pushed an example of a multi-platform image with some Go code built for Linux in both amd64 and arm64. Assuming you've enabled containerd for a local docker install, the tarball it produces can be If you have an Apple Silicon machine, you can do this: % bazel build //examples/multi_arch_go:image-multiarch-tar
INFO: Invocation ID: 0713b09c-525d-42e3-a825-b732f6dd581e
INFO: Analyzed target //examples/multi_arch_go:image-multiarch-tar (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //examples/multi_arch_go:image-multiarch-tar up-to-date:
bazel-bin/examples/multi_arch_go/image-multiarch-tar/tarball.tar
INFO: Elapsed time: 0.339s, Critical Path: 0.13s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
% docker load <bazel-bin/examples/multi_arch_go/image-multiarch-tar/tarball.tar
Loaded image: docker.com/example
% docker run -it --rm --platform linux/amd64 docker.com/example
yo
% docker run -it --rm --platform linux/arm64 docker.com/example
yo From this you can see this |
(I think one of the key pieces of information here is that while docker style tarballs don't support multi-platform images, oci style ones do, and docker can be configured to work with oci style tarballs) |
is this the case for standard setup? |
With docker desktop, there's a "features in development" flag you can enable: https://docs.docker.com/desktop/containerd/ (I'm not actually using docker desktop, I'm using a different system which understands OCI format images, but it's easy to test in docker desktop :)) I'm assuming this feature is reasonably in scope for rules_oci, given it's about oci-spec formatting rather than specifically docker interoperation. |
ideally, we should not implement hacks. it's the reason why we don't produce |
I wouldn't classify this as a hack... It is unfortunate that we're having to generate the Would it feel more clean if there were an attribute on I agree that it's confusing that there are two possible output formats (oci and docker), and that |
The more I think about it, the more I think that having an So the current state of the repo would only support "docker", and would error if you gave it an oci image to tar up (e.g. an |
I am not sure what you mean by this but docker-style tarballs are supported by all container runtimes. I am warm to the idea of having two output formats specified by a while Also, if you could keep the diff minimal, that'd be great. |
Hi @illicitonion, Thank you very much for working on this, it is also a feature we would really like. Just curious, when we were trying it out we saw the following error:
Just curious if you know why that would be. Thank you. |
290c48a
to
3a94776
Compare
@thesayyn Thanks for the review, and sorry for the ridiculous delay in getting back to you. I've added the I've also reworked the PR slightly to minimise the diff - the old codepath now hopefully is more clearly mostly unchanged, and the new codepath is mostly just additions not modifications. Please let me know if you have more ideas or comments! :) |
@kriscfoster It sounds like you're running docker without |
Thank you @illicitonion, this worked! |
Do we know what is needed for this to make it to |
Note, this will have big merge conflict against #385, we'll see who gets in first :) |
Hopefully this is ~good to go! @alexeagle What's your timeline for #385? I'm happy to do either rebase (it should be trivial, just every |
e1a8026
to
306c30e
Compare
306c30e
to
71995d1
Compare
Sorry to dig up an old issue, @illicitonion since you authored these changes and you seem to have experience in the topic, I've hit the same error as @kriscfoster but through Skaffold (which is using Docker Engine API). More context: GoogleContainerTools/skaffold#9217 Any idea why this wouldn't work? I would assume it should, since I'm able to Is there any way we could add support for multi-arch |
Friendly ping @illicitonion, if you have any pointers about the above message ☝🏻 🙏🏻 |
Sorry, I don't have any useful context here - it sounds like skaffold needs OCI format support. |
Fixes #112