Skip to content

Commit 921b576

Browse files
authored
Merge pull request #3023 from tonistiigi/dockerd-push-fix
avoid double pushing with docker driver with containerd
2 parents 548c80a + 4f7d145 commit 921b576

File tree

6 files changed

+6
-1
lines changed

6 files changed

+6
-1
lines changed

build/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opts map[
539539
node := dp.Node().Driver
540540
if node.IsMobyDriver() {
541541
for _, e := range so.Exports {
542-
if e.Type == "moby" && e.Attrs["push"] != "" {
542+
if e.Type == "moby" && e.Attrs["push"] != "" && !node.Features(ctx)[driver.DirectPush] {
543543
if ok, _ := strconv.ParseBool(e.Attrs["push"]); ok {
544544
pushNames = e.Attrs["name"]
545545
if pushNames == "" {

driver/docker-container/driver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ func (d *Driver) Features(ctx context.Context) map[driver.Feature]bool {
420420
driver.DockerExporter: true,
421421
driver.CacheExport: true,
422422
driver.MultiPlatform: true,
423+
driver.DirectPush: true,
423424
driver.DefaultLoad: d.defaultLoad,
424425
}
425426
}

driver/docker/driver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ func (d *Driver) Features(ctx context.Context) map[driver.Feature]bool {
9393
driver.DockerExporter: useContainerdSnapshotter,
9494
driver.CacheExport: useContainerdSnapshotter,
9595
driver.MultiPlatform: useContainerdSnapshotter,
96+
driver.DirectPush: useContainerdSnapshotter,
9697
driver.DefaultLoad: true,
9798
}
9899
})

driver/features.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ const DockerExporter Feature = "Docker exporter"
77

88
const CacheExport Feature = "Cache export"
99
const MultiPlatform Feature = "Multi-platform build"
10+
const DirectPush Feature = "Direct push"
1011

1112
const DefaultLoad Feature = "Automatically load images to the Docker Engine image store"

driver/kubernetes/driver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ func (d *Driver) Features(_ context.Context) map[driver.Feature]bool {
238238
driver.DockerExporter: d.DockerAPI != nil,
239239
driver.CacheExport: true,
240240
driver.MultiPlatform: true, // Untested (needs multiple Driver instances)
241+
driver.DirectPush: true,
241242
driver.DefaultLoad: d.defaultLoad,
242243
}
243244
}

driver/remote/driver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ func (d *Driver) Features(ctx context.Context) map[driver.Feature]bool {
164164
driver.DockerExporter: true,
165165
driver.CacheExport: true,
166166
driver.MultiPlatform: true,
167+
driver.DirectPush: true,
167168
driver.DefaultLoad: d.defaultLoad,
168169
}
169170
}

0 commit comments

Comments
 (0)