-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
--load
with moby containerd store should use the oci
exporter
#1813
Conversation
55a5193
to
76f7bf4
Compare
I don't think this is necessarily what we want. I think we shouldn't change the behavior of |
I like the idea that when pushing to Docker, it automatically pushes in OCI format if supported. For However, this latter approach means
I think this would be surprising to users, and isn't what the It's not inconsistent with the docs, but if taking this latter approach, we might also want to rework the |
I think the confusion may come from that in |
First of all, there is no need for anyone to write Another thing is that you can imagine that there will be other ways to get build results into docker in the future, eg. moby/moby#44369 . The behavior of the exporter should not be defined by a specific implementation but the expected end goal. For bake, note that |
76f7bf4
to
931feca
Compare
Should be good now 🎉 However, we actually need to pass the I wonder if we should maybe change this requirement in the next version of buildkit? We have safeguards to prevent this in buildx now (since v0.6 #582). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @rumpl
// rely on oci importer if available (which supports | ||
// multi-platform images), otherwise fall back to docker | ||
opt.Exports[i].Type = "oci" | ||
} else if len(opt.Platforms) > 1 || len(attests) > 0 { | ||
return nil, nil, errors.Errorf("docker exporter does not currently support exporting manifest lists") | ||
} | ||
if e.Output == nil { | ||
if nodeDriver.IsMobyDriver() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changing in this PR but shouldn't this also have a "context" check?
util/dockerutil/client.go
Outdated
@@ -63,6 +63,28 @@ func (c *Client) LoadImage(ctx context.Context, name string, status progress.Wri | |||
}, nil | |||
} | |||
|
|||
func (c *Client) Features(ctx context.Context, name string) (map[Feature]bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In discussion with @crazy-max about #1846, we noticed that this probably needs a similar cache to ensure that we don't create a new docker client in each loop of the toSolveOpt
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can try and do this as a follow-up though, would be good to not block another RC on this.
aa4afa7
to
e89ed57
Compare
Aha, reworked the |
I have a couple of questions:
|
e89ed57
to
b3d573d
Compare
Not directly, no. We take the output of the OCI exporter and pipe it into the
An important point. This doesn't work when doing moby-buildkit for whatever reason for me... 🤔 (but that's using the Starting from an empty state (
(note, single platform builds work fine) This does work when using the
Slightly confused at the difference in sizes of images... is something maybe not getting unpacked? |
Could potentially be related to moby/buildkit#3891? |
This looks more like issue with the load command on dockerd with containerd enabled rather than build-side. We basically just issue |
The case with |
Are we still talking about the |
That case should be working since #1262 |
Signed-off-by: Justin Chadwell <me@jedevc.com>
Done some more investigation - I think this out of scope for this PR, so we probably shouldn't block on it. I can reproduce the same issue with the |
b3d573d
to
183a73a
Compare
@tonistiigi PTAL |
@@ -63,6 +63,23 @@ func (c *Client) LoadImage(ctx context.Context, name string, status progress.Wri | |||
}, nil | |||
} | |||
|
|||
func (c *Client) Features(ctx context.Context, name string) map[Feature]bool { | |||
features := make(map[Feature]bool) | |||
if dapi, err := c.API(name); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a follow-up this function could do caching these return values for bake
and if we add any more Feature
values we probably would need to ask for a specific one to make sure expensive call like info
is not done needlessly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested it, seems to work great, awesome work @jedevc, thanks!
Hello, is there a way to use OCI exported in case of |
@Felixoid this doesn't seem related to this PR, which is about In any case, if looks like you might want |
Thank you, I'll try the parameter |
Moby with the containerd store supports importing multi-platform OCI images, which means we should be able to add functionality to have
--load
work with multi-platform images.Before:
After:
This patch works by translating the
docker
exporter to anoci
exporter (which supports multi-platform exports), just as we were previously translating thedocker
exporter to themoby
exporter for the moby case.I think this should just work? I've done some basic tests with some sample bake files, and build commands from my history, and get the expected results (and don't get any different behavior on non-containerd moby) 🎉
(I can add some integration tests once #1770 merges)
cc @tonistiigi @vvoland @rumpl
Related issues
--load
equivalent for the OCI exporter #1522 (cc @TBBle)