Browse code

Merge pull request #50068 from mmorel-35/github.com/containerd/errdefs

refactor: replace uses of errdefs package

Paweł Gronowski authored on 2025/05/28 21:57:15
Showing 86 changed files
... ...
@@ -251,11 +251,6 @@ linters:
251 251
         linters:
252 252
           - forbidigo
253 253
 
254
-        # FIXME(dmcgowan): ignoring while transitioning to containerd/errdefs
255
-      - text: "SA1019: errdefs\\.(.*) is deprecated"
256
-        linters:
257
-          - staticcheck
258
-
259 254
     # Log a warning if an exclusion rule is unused.
260 255
     # Default: false
261 256
     warn-unused: true
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"strconv"
8 8
 	"testing"
9 9
 
10
-	"github.com/docker/docker/errdefs"
10
+	cerrdefs "github.com/containerd/errdefs"
11 11
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
12 12
 	"gotest.tools/v3/assert"
13 13
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -225,7 +225,7 @@ func TestDecodePlatform(t *testing.T) {
225 225
 			p, err := DecodePlatform(tc.platformJSON)
226 226
 			assert.Check(t, is.DeepEqual(p, tc.expected))
227 227
 			if tc.expectedErr != "" {
228
-				assert.Check(t, errdefs.IsInvalidParameter(err))
228
+				assert.Check(t, cerrdefs.IsInvalidArgument(err))
229 229
 				assert.Check(t, is.Error(err, tc.expectedErr))
230 230
 			} else {
231 231
 				assert.Check(t, err)
... ...
@@ -6,6 +6,7 @@ import (
6 6
 	"net/http"
7 7
 	"strconv"
8 8
 
9
+	cerrdefs "github.com/containerd/errdefs"
9 10
 	"github.com/containerd/log"
10 11
 	"github.com/docker/docker/api/server/httputils"
11 12
 	"github.com/docker/docker/api/types/filters"
... ...
@@ -69,7 +70,7 @@ func (v *volumeRouter) getVolumeByName(ctx context.Context, w http.ResponseWrite
69 69
 	// if the volume is not found in the regular volume backend, and the client
70 70
 	// is using an API version greater than 1.42 (when cluster volumes were
71 71
 	// introduced), then check if Swarm has the volume.
72
-	if errdefs.IsNotFound(err) && versions.GreaterThanOrEqualTo(version, clusterVolumesVersion) && v.cluster.IsManager() {
72
+	if cerrdefs.IsNotFound(err) && versions.GreaterThanOrEqualTo(version, clusterVolumesVersion) && v.cluster.IsManager() {
73 73
 		swarmVol, err := v.cluster.GetVolume(vars["name"])
74 74
 		// if swarm returns an error and that error indicates that swarm is not
75 75
 		// initialized, return original NotFound error. Otherwise, we'd return
... ...
@@ -164,7 +165,7 @@ func (v *volumeRouter) deleteVolumes(ctx context.Context, w http.ResponseWriter,
164 164
 	// errors at this stage. Note that no "not found" error is produced if
165 165
 	// "force" is enabled.
166 166
 	err := v.backend.Remove(ctx, vars["name"], opts.WithPurgeOnError(force))
167
-	if err != nil && !errdefs.IsNotFound(err) {
167
+	if err != nil && !cerrdefs.IsNotFound(err) {
168 168
 		return err
169 169
 	}
170 170
 
... ...
@@ -172,7 +173,7 @@ func (v *volumeRouter) deleteVolumes(ctx context.Context, w http.ResponseWriter,
172 172
 	// is enabled, the volume backend won't return an error for non-existing
173 173
 	// volumes, so we don't know if removal succeeded (or not volume existed).
174 174
 	// In that case we always try to delete cluster volumes as well.
175
-	if errdefs.IsNotFound(err) || force {
175
+	if cerrdefs.IsNotFound(err) || force {
176 176
 		version := httputils.VersionFromContext(ctx)
177 177
 		if versions.GreaterThanOrEqualTo(version, clusterVolumesVersion) && v.cluster.IsManager() {
178 178
 			err = v.cluster.RemoveVolume(vars["name"], force)
... ...
@@ -11,6 +11,7 @@ import (
11 11
 
12 12
 	"gotest.tools/v3/assert"
13 13
 
14
+	cerrdefs "github.com/containerd/errdefs"
14 15
 	"github.com/docker/docker/api/server/httputils"
15 16
 	"github.com/docker/docker/api/types/filters"
16 17
 	"github.com/docker/docker/api/types/volume"
... ...
@@ -47,7 +48,7 @@ func TestGetVolumeByNameNotFoundNoSwarm(t *testing.T) {
47 47
 	_, err := callGetVolume(v, "notReal")
48 48
 
49 49
 	assert.Assert(t, err != nil)
50
-	assert.Assert(t, errdefs.IsNotFound(err))
50
+	assert.Assert(t, cerrdefs.IsNotFound(err))
51 51
 }
52 52
 
53 53
 func TestGetVolumeByNameNotFoundNotManager(t *testing.T) {
... ...
@@ -59,7 +60,7 @@ func TestGetVolumeByNameNotFoundNotManager(t *testing.T) {
59 59
 	_, err := callGetVolume(v, "notReal")
60 60
 
61 61
 	assert.Assert(t, err != nil)
62
-	assert.Assert(t, errdefs.IsNotFound(err))
62
+	assert.Assert(t, cerrdefs.IsNotFound(err))
63 63
 }
64 64
 
65 65
 func TestGetVolumeByNameNotFound(t *testing.T) {
... ...
@@ -71,7 +72,7 @@ func TestGetVolumeByNameNotFound(t *testing.T) {
71 71
 	_, err := callGetVolume(v, "notReal")
72 72
 
73 73
 	assert.Assert(t, err != nil)
74
-	assert.Assert(t, errdefs.IsNotFound(err))
74
+	assert.Assert(t, cerrdefs.IsNotFound(err))
75 75
 }
76 76
 
77 77
 func TestGetVolumeByNameFoundRegular(t *testing.T) {
... ...
@@ -238,7 +239,7 @@ func TestCreateSwarmVolumeNoSwarm(t *testing.T) {
238 238
 	resp := httptest.NewRecorder()
239 239
 	err = v.postVolumesCreate(ctx, resp, req, nil)
240 240
 	assert.Assert(t, err != nil)
241
-	assert.Assert(t, errdefs.IsUnavailable(err))
241
+	assert.Assert(t, cerrdefs.IsUnavailable(err))
242 242
 }
243 243
 
244 244
 func TestCreateSwarmVolumeNotManager(t *testing.T) {
... ...
@@ -267,7 +268,7 @@ func TestCreateSwarmVolumeNotManager(t *testing.T) {
267 267
 	resp := httptest.NewRecorder()
268 268
 	err = v.postVolumesCreate(ctx, resp, req, nil)
269 269
 	assert.Assert(t, err != nil)
270
-	assert.Assert(t, errdefs.IsUnavailable(err))
270
+	assert.Assert(t, cerrdefs.IsUnavailable(err))
271 271
 }
272 272
 
273 273
 func TestCreateVolumeCluster(t *testing.T) {
... ...
@@ -376,7 +377,7 @@ func TestUpdateVolumeNoSwarm(t *testing.T) {
376 376
 
377 377
 	err = v.putVolumesUpdate(ctx, resp, req, map[string]string{"name": "vol1"})
378 378
 	assert.Assert(t, err != nil)
379
-	assert.Assert(t, errdefs.IsUnavailable(err))
379
+	assert.Assert(t, cerrdefs.IsUnavailable(err))
380 380
 }
381 381
 
382 382
 func TestUpdateVolumeNotFound(t *testing.T) {
... ...
@@ -408,7 +409,7 @@ func TestUpdateVolumeNotFound(t *testing.T) {
408 408
 
409 409
 	err = v.putVolumesUpdate(ctx, resp, req, map[string]string{"name": "vol1"})
410 410
 	assert.Assert(t, err != nil)
411
-	assert.Assert(t, errdefs.IsNotFound(err))
411
+	assert.Assert(t, cerrdefs.IsNotFound(err))
412 412
 }
413 413
 
414 414
 func TestVolumeRemove(t *testing.T) {
... ...
@@ -476,7 +477,7 @@ func TestVolumeRemoveNotFoundNoSwarm(t *testing.T) {
476 476
 
477 477
 	err := v.deleteVolumes(ctx, resp, req, map[string]string{"name": "vol1"})
478 478
 	assert.Assert(t, err != nil)
479
-	assert.Assert(t, errdefs.IsNotFound(err), err.Error())
479
+	assert.Assert(t, cerrdefs.IsNotFound(err), err.Error())
480 480
 }
481 481
 
482 482
 func TestVolumeRemoveNotFoundNoManager(t *testing.T) {
... ...
@@ -493,7 +494,7 @@ func TestVolumeRemoveNotFoundNoManager(t *testing.T) {
493 493
 
494 494
 	err := v.deleteVolumes(ctx, resp, req, map[string]string{"name": "vol1"})
495 495
 	assert.Assert(t, err != nil)
496
-	assert.Assert(t, errdefs.IsNotFound(err))
496
+	assert.Assert(t, cerrdefs.IsNotFound(err))
497 497
 }
498 498
 
499 499
 func TestVolumeRemoveFoundNoSwarm(t *testing.T) {
... ...
@@ -540,7 +541,7 @@ func TestVolumeRemoveNoSwarmInUse(t *testing.T) {
540 540
 
541 541
 	err := v.deleteVolumes(ctx, resp, req, map[string]string{"name": "inuse"})
542 542
 	assert.Assert(t, err != nil)
543
-	assert.Assert(t, errdefs.IsConflict(err))
543
+	assert.Assert(t, cerrdefs.IsConflict(err))
544 544
 }
545 545
 
546 546
 func TestVolumeRemoveSwarmForce(t *testing.T) {
... ...
@@ -569,7 +570,7 @@ func TestVolumeRemoveSwarmForce(t *testing.T) {
569 569
 	err := v.deleteVolumes(ctx, resp, req, map[string]string{"name": "vol1"})
570 570
 
571 571
 	assert.Assert(t, err != nil)
572
-	assert.Assert(t, errdefs.IsConflict(err))
572
+	assert.Assert(t, cerrdefs.IsConflict(err))
573 573
 
574 574
 	ctx = context.WithValue(context.Background(), httputils.APIVersionKey{}, clusterVolumesVersion)
575 575
 	req = httptest.NewRequest(http.MethodDelete, "/volumes/vol1?force=1", nil)
... ...
@@ -102,7 +102,7 @@ func TestValidateRestartPolicy(t *testing.T) {
102 102
 	}
103 103
 }
104 104
 
105
-// isInvalidParameter is a minimal implementation of [github.com/docker/docker/errdefs.IsInvalidParameter],
105
+// isInvalidParameter is a minimal implementation of [github.com/containerd/errdefs.IsInvalidArgument],
106 106
 // because this was the only import of that package in api/types, which is the
107 107
 // package imported by external users.
108 108
 func isInvalidParameter(err error) bool {
... ...
@@ -5,11 +5,11 @@ import (
5 5
 	"fmt"
6 6
 	"io"
7 7
 
8
+	cerrdefs "github.com/containerd/errdefs"
8 9
 	"github.com/containerd/log"
9 10
 	"github.com/docker/docker/api/types/backend"
10 11
 	"github.com/docker/docker/api/types/container"
11 12
 	"github.com/docker/docker/builder"
12
-	"github.com/docker/docker/errdefs"
13 13
 	"github.com/docker/docker/pkg/stringid"
14 14
 	"github.com/pkg/errors"
15 15
 )
... ...
@@ -126,7 +126,7 @@ func (e *statusCodeError) StatusCode() int {
126 126
 // RemoveAll containers managed by this container manager
127 127
 func (c *containerManager) RemoveAll(stdout io.Writer) {
128 128
 	for containerID := range c.tmpContainers {
129
-		if err := c.backend.ContainerRm(containerID, &backend.ContainerRmConfig{ForceRemove: true, RemoveVolume: true}); err != nil && !errdefs.IsNotFound(err) {
129
+		if err := c.backend.ContainerRm(containerID, &backend.ContainerRmConfig{ForceRemove: true, RemoveVolume: true}); err != nil && !cerrdefs.IsNotFound(err) {
130 130
 			_, _ = fmt.Fprintf(stdout, "Removing intermediate container %s: %v\n", stringid.TruncateID(containerID), err)
131 131
 			continue
132 132
 		}
... ...
@@ -14,6 +14,7 @@ import (
14 14
 	"time"
15 15
 
16 16
 	"github.com/containerd/containerd/v2/pkg/cio"
17
+	cerrdefs "github.com/containerd/errdefs"
17 18
 	"github.com/containerd/log"
18 19
 	"github.com/containerd/platforms"
19 20
 	containertypes "github.com/docker/docker/api/types/container"
... ...
@@ -814,7 +815,7 @@ func (container *Container) RestoreTask(ctx context.Context, client libcontainer
814 814
 		return err
815 815
 	}
816 816
 	container.task, err = container.ctr.AttachTask(ctx, container.InitializeStdio)
817
-	if err != nil && !errdefs.IsNotFound(err) {
817
+	if err != nil && !cerrdefs.IsNotFound(err) {
818 818
 		return err
819 819
 	}
820 820
 	return nil
... ...
@@ -7,8 +7,8 @@ import (
7 7
 	"path/filepath"
8 8
 	"testing"
9 9
 
10
+	cerrdefs "github.com/containerd/errdefs"
10 11
 	"github.com/docker/docker/api/types/container"
11
-	"github.com/docker/docker/errdefs"
12 12
 	"github.com/docker/docker/pkg/stringid"
13 13
 	"github.com/google/uuid"
14 14
 	"gotest.tools/v3/assert"
... ...
@@ -87,7 +87,7 @@ func TestNames(t *testing.T) {
87 87
 	assert.Check(t, db.ReserveName("name2", "containerid2"))
88 88
 
89 89
 	err = db.ReserveName("name2", "containerid3")
90
-	assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
90
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
91 91
 	assert.Check(t, is.Error(err, "name is reserved"))
92 92
 
93 93
 	// Releasing a name allows the name to point to something else later.
... ...
@@ -105,7 +105,7 @@ func TestNames(t *testing.T) {
105 105
 	assert.Check(t, is.Equal("containerid3", id))
106 106
 
107 107
 	_, err = view.GetID("notreserved")
108
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
108
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
109 109
 	assert.Check(t, is.Error(err, "name is not reserved"))
110 110
 
111 111
 	// Releasing and re-reserving a name doesn't affect the snapshot.
... ...
@@ -163,7 +163,7 @@ func TestTruncIndex(t *testing.T) {
163 163
 
164 164
 	// Get on an empty index
165 165
 	_, err = db.GetByPrefix("foobar")
166
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
166
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
167 167
 
168 168
 	// Add an id
169 169
 	const id = "99b36c2c326ccc11e726eee6ee78a0baf166ef96"
... ...
@@ -4,6 +4,7 @@ import (
4 4
 	"io"
5 5
 	"os"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	"github.com/docker/docker/api/types/container"
8 9
 	"github.com/docker/docker/errdefs"
9 10
 )
... ...
@@ -22,7 +23,7 @@ func (daemon *Daemon) ContainerStatPath(name string, path string) (*container.Pa
22 22
 			return nil, containerFileNotFound{path, name}
23 23
 		}
24 24
 		// TODO(thaJeztah): check if daemon.containerStatPath returns any errors that are not typed; if not, then return as-is
25
-		if errdefs.IsInvalidParameter(err) {
25
+		if cerrdefs.IsInvalidArgument(err) {
26 26
 			return nil, err
27 27
 		}
28 28
 		return nil, errdefs.System(err)
... ...
@@ -45,7 +46,7 @@ func (daemon *Daemon) ContainerArchivePath(name string, path string) (content io
45 45
 			return nil, nil, containerFileNotFound{path, name}
46 46
 		}
47 47
 		// TODO(thaJeztah): check if daemon.containerArchivePath returns any errors that are not typed; if not, then return as-is
48
-		if errdefs.IsInvalidParameter(err) {
48
+		if cerrdefs.IsInvalidArgument(err) {
49 49
 			return nil, nil, err
50 50
 		}
51 51
 		return nil, nil, errdefs.System(err)
... ...
@@ -71,7 +72,7 @@ func (daemon *Daemon) ContainerExtractToDir(name, path string, copyUIDGID, noOve
71 71
 			return containerFileNotFound{path, name}
72 72
 		}
73 73
 		// TODO(thaJeztah): check if daemon.containerExtractToDir returns any errors that are not typed; if not, then return as-is
74
-		if errdefs.IsInvalidParameter(err) {
74
+		if cerrdefs.IsInvalidArgument(err) {
75 75
 			return err
76 76
 		}
77 77
 		return errdefs.System(err)
... ...
@@ -5,13 +5,13 @@ import (
5 5
 	"io"
6 6
 	"net/http"
7 7
 
8
+	cerrdefs "github.com/containerd/errdefs"
8 9
 	"github.com/containerd/log"
9 10
 	"github.com/distribution/reference"
10 11
 	"github.com/docker/docker/api/types"
11 12
 	"github.com/docker/docker/api/types/backend"
12 13
 	"github.com/docker/docker/api/types/registry"
13 14
 	"github.com/docker/docker/api/types/swarm/runtime"
14
-	"github.com/docker/docker/errdefs"
15 15
 	"github.com/docker/docker/plugin"
16 16
 	v2 "github.com/docker/docker/plugin/v2"
17 17
 	"github.com/gogo/protobuf/proto"
... ...
@@ -200,7 +200,7 @@ func (p *Controller) Wait(ctx context.Context) error {
200 200
 }
201 201
 
202 202
 func isNotFound(err error) bool {
203
-	return errdefs.IsNotFound(err)
203
+	return cerrdefs.IsNotFound(err)
204 204
 }
205 205
 
206 206
 // Shutdown is the shutdown phase from swarmkit
... ...
@@ -8,10 +8,10 @@ import (
8 8
 	"strings"
9 9
 	"time"
10 10
 
11
+	cerrdefs "github.com/containerd/errdefs"
11 12
 	"github.com/docker/docker/api/types/container"
12 13
 	"github.com/docker/docker/api/types/events"
13 14
 	executorpkg "github.com/docker/docker/daemon/cluster/executor"
14
-	"github.com/docker/docker/errdefs"
15 15
 	"github.com/docker/docker/libnetwork"
16 16
 	"github.com/docker/go-connections/nat"
17 17
 	gogotypes "github.com/gogo/protobuf/types"
... ...
@@ -66,7 +66,7 @@ func (r *controller) Task() (*api.Task, error) {
66 66
 func (r *controller) ContainerStatus(ctx context.Context) (*api.ContainerStatus, error) {
67 67
 	ctnr, err := r.adapter.inspect(ctx)
68 68
 	if err != nil {
69
-		if errdefs.IsNotFound(err) {
69
+		if cerrdefs.IsNotFound(err) {
70 70
 			return nil, nil
71 71
 		}
72 72
 		return nil, err
... ...
@@ -77,7 +77,7 @@ func (r *controller) ContainerStatus(ctx context.Context) (*api.ContainerStatus,
77 77
 func (r *controller) PortStatus(ctx context.Context) (*api.PortStatus, error) {
78 78
 	ctnr, err := r.adapter.inspect(ctx)
79 79
 	if err != nil {
80
-		if errdefs.IsNotFound(err) {
80
+		if cerrdefs.IsNotFound(err) {
81 81
 			return nil, nil
82 82
 		}
83 83
 
... ...
@@ -179,7 +179,7 @@ func (r *controller) Prepare(ctx context.Context) error {
179 179
 		}
180 180
 	}
181 181
 	if err := r.adapter.create(ctx); err != nil {
182
-		if errdefs.IsConflict(err) {
182
+		if cerrdefs.IsConflict(err) {
183 183
 			if _, err := r.adapter.inspect(ctx); err != nil {
184 184
 				return err
185 185
 			}
... ...
@@ -382,7 +382,7 @@ func (r *controller) Shutdown(ctx context.Context) error {
382 382
 	}
383 383
 
384 384
 	if err := r.adapter.shutdown(ctx); err != nil {
385
-		if !errdefs.IsNotFound(err) && !errdefs.IsNotModified(err) {
385
+		if !cerrdefs.IsNotFound(err) && !cerrdefs.IsNotModified(err) {
386 386
 			return err
387 387
 		}
388 388
 	}
... ...
@@ -390,7 +390,7 @@ func (r *controller) Shutdown(ctx context.Context) error {
390 390
 	// Try removing networks referenced in this task in case this
391 391
 	// task is the last one referencing it
392 392
 	if err := r.adapter.removeNetworks(ctx); err != nil {
393
-		if !errdefs.IsNotFound(err) {
393
+		if !cerrdefs.IsNotFound(err) {
394 394
 			return err
395 395
 		}
396 396
 	}
... ...
@@ -409,7 +409,7 @@ func (r *controller) Terminate(ctx context.Context) error {
409 409
 	}
410 410
 
411 411
 	if err := r.adapter.terminate(ctx); err != nil {
412
-		if errdefs.IsNotFound(err) {
412
+		if cerrdefs.IsNotFound(err) {
413 413
 			return nil
414 414
 		}
415 415
 
... ...
@@ -431,7 +431,7 @@ func (r *controller) Remove(ctx context.Context) error {
431 431
 
432 432
 	// It may be necessary to shut down the task before removing it.
433 433
 	if err := r.Shutdown(ctx); err != nil {
434
-		if errdefs.IsNotFound(err) {
434
+		if cerrdefs.IsNotFound(err) {
435 435
 			return nil
436 436
 		}
437 437
 		// This may fail if the task was already shut down.
... ...
@@ -439,7 +439,7 @@ func (r *controller) Remove(ctx context.Context) error {
439 439
 	}
440 440
 
441 441
 	if err := r.adapter.remove(ctx); err != nil {
442
-		if errdefs.IsNotFound(err) {
442
+		if cerrdefs.IsNotFound(err) {
443 443
 			return nil
444 444
 		}
445 445
 
... ...
@@ -462,7 +462,7 @@ func (r *controller) waitReady(pctx context.Context) error {
462 462
 
463 463
 	ctnr, err := r.adapter.inspect(ctx)
464 464
 	if err != nil {
465
-		if !errdefs.IsNotFound(err) {
465
+		if !cerrdefs.IsNotFound(err) {
466 466
 			return errors.Wrap(err, "inspect container failed")
467 467
 		}
468 468
 	} else {
... ...
@@ -4,6 +4,7 @@ import (
4 4
 	"context"
5 5
 	"fmt"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	volumetypes "github.com/docker/docker/api/types/volume"
8 9
 	"github.com/docker/docker/daemon/cluster/convert"
9 10
 	"github.com/docker/docker/errdefs"
... ...
@@ -90,7 +91,7 @@ func (c *Cluster) RemoveVolume(nameOrID string, force bool) error {
90 90
 	return c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
91 91
 		volume, err := getVolume(ctx, state.controlClient, nameOrID)
92 92
 		if err != nil {
93
-			if force && errdefs.IsNotFound(err) {
93
+			if force && cerrdefs.IsNotFound(err) {
94 94
 				return nil
95 95
 			}
96 96
 			return err
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"strings"
14 14
 	"time"
15 15
 
16
+	cerrdefs "github.com/containerd/errdefs"
16 17
 	"github.com/containerd/log"
17 18
 	containertypes "github.com/docker/docker/api/types/container"
18 19
 	"github.com/docker/docker/api/types/events"
... ...
@@ -899,7 +900,7 @@ func (daemon *Daemon) getNetworkedContainer(containerID, connectedContainerPrefi
899 899
 	nc, err := daemon.GetContainer(connectedContainerPrefixOrName)
900 900
 	if err != nil {
901 901
 		err = fmt.Errorf("joining network namespace of container: %w", err)
902
-		if errdefs.IsNotFound(err) {
902
+		if cerrdefs.IsNotFound(err) {
903 903
 			// Deliberately masking "not found" errors, because failing to find
904 904
 			// the network container is a system error. We return a system error,
905 905
 			// not an "invalid parameter" because getNetworkedContainer is called
... ...
@@ -85,7 +85,7 @@ func (c cacheAdaptor) Get(id image.ID) (*image.Image, error) {
85 85
 
86 86
 			var config container.Config
87 87
 			if err := readJSON(ctx, c.is.content, configDesc, &config); err != nil {
88
-				if !errdefs.IsNotFound(err) {
88
+				if !cerrdefs.IsNotFound(err) {
89 89
 					log.G(ctx).WithFields(log.Fields{
90 90
 						"configDigest": dgst,
91 91
 						"error":        err,
... ...
@@ -87,7 +87,7 @@ func (i *ImageService) GetImageAndReleasableLayer(ctx context.Context, refOrID s
87 87
 			return nil, nil, err
88 88
 		}
89 89
 		imgDesc, err := i.resolveDescriptor(ctx, refOrID)
90
-		if err != nil && !errdefs.IsNotFound(err) {
90
+		if err != nil && !cerrdefs.IsNotFound(err) {
91 91
 			return nil, nil, err
92 92
 		}
93 93
 		if img != nil {
... ...
@@ -152,7 +152,7 @@ func (i *ImageService) pullForBuilder(ctx context.Context, name string, authConf
152 152
 
153 153
 	img, err := i.GetImage(ctx, name, backend.GetImageOpts{Platform: platform})
154 154
 	if err != nil {
155
-		if errdefs.IsNotFound(err) && img != nil && platform != nil {
155
+		if cerrdefs.IsNotFound(err) && img != nil && platform != nil {
156 156
 			imgPlat := ocispec.Platform{
157 157
 				OS:           img.OS,
158 158
 				Architecture: img.BaseImgArch(),
... ...
@@ -259,7 +259,7 @@ func (i *ImageService) LoadImage(ctx context.Context, inTar io.ReadCloser, platf
259 259
 				if err := i.ensureDanglingImage(ctx, img); err != nil {
260 260
 					log.G(ctx).WithError(err).Warnf("failed to keep the previous image for %s as dangling", img.Name)
261 261
 				}
262
-			} else if !errdefs.IsNotFound(err) {
262
+			} else if !cerrdefs.IsNotFound(err) {
263 263
 				log.G(ctx).WithError(err).Warn("failed to retrieve image: %w", err)
264 264
 			}
265 265
 			return true
... ...
@@ -241,7 +241,7 @@ func (i *ImageService) multiPlatformSummary(ctx context.Context, img c8dimages.I
241 241
 		})
242 242
 
243 243
 		available, err := img.CheckContentAvailable(ctx)
244
-		if err != nil && !errdefs.IsNotFound(err) {
244
+		if err != nil && !cerrdefs.IsNotFound(err) {
245 245
 			logger.WithError(err).Warn("checking availability of platform specific manifest failed")
246 246
 			return nil
247 247
 		}
... ...
@@ -276,7 +276,7 @@ func (i *ImageService) multiPlatformSummary(ctx context.Context, img c8dimages.I
276 276
 		// so we don't error out the whole list in case the error is related to
277 277
 		// the content itself (e.g. corrupted data) or just manifest kind that
278 278
 		// we don't know about (yet).
279
-		if err != nil && !errdefs.IsNotFound(err) {
279
+		if err != nil && !cerrdefs.IsNotFound(err) {
280 280
 			logger.WithError(err).Debug("pseudo image check failed")
281 281
 			return nil
282 282
 		}
... ...
@@ -660,7 +660,7 @@ func setupLabelFilter(ctx context.Context, store content.Store, fltrs filters.Ar
660 660
 			}
661 661
 			var cfg configLabels
662 662
 			if err := readJSON(ctx, store, desc, &cfg); err != nil {
663
-				if errdefs.IsNotFound(err) {
663
+				if cerrdefs.IsNotFound(err) {
664 664
 					return nil, nil
665 665
 				}
666 666
 				return nil, err
... ...
@@ -11,8 +11,8 @@ import (
11 11
 	"github.com/containerd/containerd/v2/core/content"
12 12
 	"github.com/containerd/containerd/v2/pkg/namespaces"
13 13
 	"github.com/containerd/containerd/v2/plugins/content/local"
14
+	cerrdefs "github.com/containerd/errdefs"
14 15
 	"github.com/containerd/platforms"
15
-	"github.com/docker/docker/errdefs"
16 16
 	"github.com/docker/docker/internal/testutils/labelstore"
17 17
 	"github.com/docker/docker/internal/testutils/specialimage"
18 18
 	"github.com/moby/go-archive"
... ...
@@ -62,7 +62,7 @@ func TestImageLoadMissing(t *testing.T) {
62 62
 
63 63
 		err = tryLoad(ctx, t, imgDataDir, linuxAmd64)
64 64
 		assert.Check(t, is.Error(err, "image emptyindex:latest was loaded, but doesn't provide the requested platform (linux/amd64)"))
65
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
65
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
66 66
 	})
67 67
 	clearStore(ctx, t)
68 68
 
... ...
@@ -74,7 +74,7 @@ func TestImageLoadMissing(t *testing.T) {
74 74
 
75 75
 		err = tryLoad(ctx, t, imgDataDir, linuxArm64)
76 76
 		assert.Check(t, is.ErrorContains(err, "doesn't provide the requested platform (linux/arm64)"))
77
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
77
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
78 78
 	})
79 79
 
80 80
 	clearStore(ctx, t)
... ...
@@ -87,7 +87,7 @@ func TestImageLoadMissing(t *testing.T) {
87 87
 		t.Run("platform not included in index", func(t *testing.T) {
88 88
 			err = tryLoad(ctx, t, imgDataDir, linuxArmv5)
89 89
 			assert.Check(t, is.Error(err, "image multiplatform:latest was loaded, but doesn't provide the requested platform (linux/arm/v5)"))
90
-			assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
90
+			assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
91 91
 		})
92 92
 
93 93
 		clearStore(ctx, t)
... ...
@@ -106,7 +106,7 @@ func TestImageLoadMissing(t *testing.T) {
106 106
 
107 107
 			err = tryLoad(ctx, t, imgDataDir, linuxArm64)
108 108
 			assert.Check(t, is.ErrorContains(err, "requested platform (linux/arm64) found, but some content is missing"))
109
-			assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
109
+			assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
110 110
 		})
111 111
 	})
112 112
 }
... ...
@@ -86,7 +86,7 @@ func (i *ImageService) pullTag(ctx context.Context, ref reference.Named, platfor
86 86
 	opts = append(opts, containerd.WithResolver(resolver))
87 87
 
88 88
 	oldImage, err := i.resolveImage(ctx, ref.String())
89
-	if err != nil && !errdefs.IsNotFound(err) {
89
+	if err != nil && !cerrdefs.IsNotFound(err) {
90 90
 		return err
91 91
 	}
92 92
 
... ...
@@ -331,7 +331,7 @@ func findMissingMountable(ctx context.Context, store content.Store, queue *jobs,
331 331
 
332 332
 	sources, err := getDigestSources(ctx, store, target.Digest)
333 333
 	if err != nil {
334
-		if !errdefs.IsNotFound(err) {
334
+		if !cerrdefs.IsNotFound(err) {
335 335
 			return nil, err
336 336
 		}
337 337
 		log.G(ctx).WithField("target", target).Debug("distribution source label not found")
... ...
@@ -12,8 +12,8 @@ import (
12 12
 
13 13
 	c8dimages "github.com/containerd/containerd/v2/core/images"
14 14
 	"github.com/containerd/containerd/v2/pkg/namespaces"
15
+	cerrdefs "github.com/containerd/errdefs"
15 16
 	"github.com/containerd/platforms"
16
-	"github.com/docker/docker/errdefs"
17 17
 	"github.com/docker/docker/internal/testutils/specialimage"
18 18
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
19 19
 	"gotest.tools/v3/assert"
... ...
@@ -279,10 +279,10 @@ func singleManifestSelected(platform ocispec.Platform) func(t *testing.T, img c8
279 279
 
280 280
 // candidateNotFound asserts that the no matching candidate was found.
281 281
 func candidateNotFound(t *testing.T, _ c8dimages.Image, desc ocispec.Descriptor, err error) {
282
-	assert.Check(t, errdefs.IsNotFound(err), "expected NotFound error, got %v, candidate: %v", err, desc.Platform)
282
+	assert.Check(t, cerrdefs.IsNotFound(err), "expected NotFound error, got %v, candidate: %v", err, desc.Platform)
283 283
 }
284 284
 
285 285
 // multipleCandidates asserts that multiple matching candidates were found and no decision could be made.
286 286
 func multipleCandidates(t *testing.T, _ c8dimages.Image, desc ocispec.Descriptor, err error) {
287
-	assert.Check(t, errdefs.IsConflict(err), "expected Conflict error, got %v, candidate: %v", err, desc.Platform)
287
+	assert.Check(t, cerrdefs.IsConflict(err), "expected Conflict error, got %v, candidate: %v", err, desc.Platform)
288 288
 }
... ...
@@ -7,8 +7,8 @@ import (
7 7
 	"testing"
8 8
 
9 9
 	"github.com/containerd/containerd/v2/pkg/namespaces"
10
+	cerrdefs "github.com/containerd/errdefs"
10 11
 	"github.com/containerd/platforms"
11
-	"github.com/docker/docker/errdefs"
12 12
 	"github.com/docker/docker/internal/testutils/specialimage"
13 13
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
14 14
 	"gotest.tools/v3/assert"
... ...
@@ -54,7 +54,7 @@ func TestImageMultiplatformSaveShallowWithNative(t *testing.T) {
54 54
 	})
55 55
 	t.Run("export missing", func(t *testing.T) {
56 56
 		err = imgSvc.ExportImage(ctx, []string{img.Name}, &arm64, io.Discard)
57
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
57
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
58 58
 	})
59 59
 }
60 60
 
... ...
@@ -94,7 +94,7 @@ func TestImageMultiplatformSaveShallowWithoutNative(t *testing.T) {
94 94
 	})
95 95
 	t.Run("export native", func(t *testing.T) {
96 96
 		err = imgSvc.ExportImage(ctx, []string{img.Name}, &native, io.Discard)
97
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
97
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
98 98
 	})
99 99
 	t.Run("export arm64", func(t *testing.T) {
100 100
 		err = imgSvc.ExportImage(ctx, []string{img.Name}, &arm64, io.Discard)
... ...
@@ -182,7 +182,7 @@ func (p *pullProgress) UpdateProgress(ctx context.Context, ongoing *jobs, out pr
182 182
 	for idx, desc := range p.layers {
183 183
 		sn, err := findMatchingSnapshot(ctx, p.snapshotter, desc)
184 184
 		if err != nil {
185
-			if errdefs.IsNotFound(err) {
185
+			if cerrdefs.IsNotFound(err) {
186 186
 				continue
187 187
 			}
188 188
 			return err
... ...
@@ -8,11 +8,11 @@ import (
8 8
 	"os"
9 9
 	"path/filepath"
10 10
 
11
+	cerrdefs "github.com/containerd/errdefs"
11 12
 	"github.com/containerd/log"
12 13
 	containertypes "github.com/docker/docker/api/types/container"
13 14
 	mounttypes "github.com/docker/docker/api/types/mount"
14 15
 	"github.com/docker/docker/container"
15
-	"github.com/docker/docker/errdefs"
16 16
 	"github.com/docker/docker/oci"
17 17
 	"github.com/docker/docker/pkg/idtools"
18 18
 	volumemounts "github.com/docker/docker/volume/mounts"
... ...
@@ -110,7 +110,7 @@ func (daemon *Daemon) populateVolume(ctx context.Context, c *container.Container
110 110
 	uid, gid := daemon.idMapping.RootPair()
111 111
 	volumePath, cleanup, err := mnt.Setup(ctx, c.MountLabel, idtools.Identity{UID: uid, GID: gid}, nil)
112 112
 	if err != nil {
113
-		if errdefs.IsNotFound(err) {
113
+		if cerrdefs.IsNotFound(err) {
114 114
 			return nil
115 115
 		}
116 116
 		log.G(ctx).WithError(err).Debugf("can't copy data from %s:%s, to %s", c.ID, mnt.Destination, volumePath)
... ...
@@ -27,6 +27,7 @@ import (
27 27
 	containerd "github.com/containerd/containerd/v2/client"
28 28
 	"github.com/containerd/containerd/v2/defaults"
29 29
 	"github.com/containerd/containerd/v2/pkg/dialer"
30
+	cerrdefs "github.com/containerd/errdefs"
30 31
 	"github.com/containerd/log"
31 32
 	"github.com/distribution/reference"
32 33
 	dist "github.com/docker/distribution"
... ...
@@ -52,7 +53,6 @@ import (
52 52
 	"github.com/docker/docker/distribution"
53 53
 	dmetadata "github.com/docker/docker/distribution/metadata"
54 54
 	"github.com/docker/docker/dockerversion"
55
-	"github.com/docker/docker/errdefs"
56 55
 	"github.com/docker/docker/image"
57 56
 	"github.com/docker/docker/internal/metrics"
58 57
 	"github.com/docker/docker/layer"
... ...
@@ -361,7 +361,7 @@ func (daemon *Daemon) restore(cfg *configStore) error {
361 361
 
362 362
 			var es *containerd.ExitStatus
363 363
 
364
-			if err := c.RestoreTask(context.Background(), daemon.containerd); err != nil && !errdefs.IsNotFound(err) {
364
+			if err := c.RestoreTask(context.Background(), daemon.containerd); err != nil && !cerrdefs.IsNotFound(err) {
365 365
 				logger(c).WithError(err).Error("failed to restore container with containerd")
366 366
 				return
367 367
 			}
... ...
@@ -378,13 +378,13 @@ func (daemon *Daemon) restore(cfg *configStore) error {
378 378
 					if !alive {
379 379
 						logger(c).Debug("cleaning up dead container process")
380 380
 						es, err = tsk.Delete(context.Background())
381
-						if err != nil && !errdefs.IsNotFound(err) {
381
+						if err != nil && !cerrdefs.IsNotFound(err) {
382 382
 							logger(c).WithError(err).Error("failed to delete task from containerd")
383 383
 							return
384 384
 						}
385 385
 					} else if !cfg.LiveRestoreEnabled {
386 386
 						logger(c).Debug("shutting down container considered alive by containerd")
387
-						if err := daemon.shutdownContainer(c); err != nil && !errdefs.IsNotFound(err) {
387
+						if err := daemon.shutdownContainer(c); err != nil && !cerrdefs.IsNotFound(err) {
388 388
 							baseLogger.WithError(err).Error("error shutting down container")
389 389
 							return
390 390
 						}
... ...
@@ -699,7 +699,7 @@ func (daemon *Daemon) restartSwarmContainers(ctx context.Context, cfg *configSto
699 699
 func (daemon *Daemon) registerLink(parent, child *container.Container, alias string) error {
700 700
 	fullName := path.Join(parent.Name, alias)
701 701
 	if err := daemon.containersReplica.ReserveName(fullName, child.ID); err != nil {
702
-		if errdefs.IsConflict(err) {
702
+		if cerrdefs.IsConflict(err) {
703 703
 			log.G(context.TODO()).Warnf("error registering link for %s, to %s, as alias %s, ignoring: %v", parent.ID, child.ID, alias, err)
704 704
 			return nil
705 705
 		}
... ...
@@ -7,9 +7,9 @@ import (
7 7
 	"runtime"
8 8
 	"testing"
9 9
 
10
+	cerrdefs "github.com/containerd/errdefs"
10 11
 	containertypes "github.com/docker/docker/api/types/container"
11 12
 	"github.com/docker/docker/container"
12
-	"github.com/docker/docker/errdefs"
13 13
 	"github.com/docker/docker/libnetwork"
14 14
 	"github.com/docker/docker/pkg/idtools"
15 15
 	volumesservice "github.com/docker/docker/volume/service"
... ...
@@ -310,7 +310,7 @@ func TestFindNetworkErrorType(t *testing.T) {
310 310
 	_, err := d.FindNetwork("fakeNet")
311 311
 	var nsn libnetwork.ErrNoSuchNetwork
312 312
 	ok := errors.As(err, &nsn)
313
-	if !errdefs.IsNotFound(err) || !ok {
313
+	if !cerrdefs.IsNotFound(err) || !ok {
314 314
 		t.Error("The FindNetwork method MUST always return an error that implements the NotFound interface and is ErrNoSuchNetwork")
315 315
 	}
316 316
 }
... ...
@@ -21,6 +21,7 @@ import (
21 21
 	"time"
22 22
 
23 23
 	"github.com/containerd/cgroups/v3"
24
+	cerrdefs "github.com/containerd/errdefs"
24 25
 	"github.com/containerd/log"
25 26
 	"github.com/docker/docker/api/types/blkiodev"
26 27
 	containertypes "github.com/docker/docker/api/types/container"
... ...
@@ -1535,7 +1536,7 @@ func (daemon *Daemon) registerLinks(container *container.Container, hostConfig *
1535 1535
 		}
1536 1536
 		child, err := daemon.GetContainer(name)
1537 1537
 		if err != nil {
1538
-			if errdefs.IsNotFound(err) {
1538
+			if cerrdefs.IsNotFound(err) {
1539 1539
 				// Trying to link to a non-existing container is not valid, and
1540 1540
 				// should return an "invalid parameter" error. Returning a "not
1541 1541
 				// found" error here would make the client report the container's
... ...
@@ -1548,7 +1549,7 @@ func (daemon *Daemon) registerLinks(container *container.Container, hostConfig *
1548 1548
 			cid := child.HostConfig.NetworkMode.ConnectedContainer()
1549 1549
 			child, err = daemon.GetContainer(cid)
1550 1550
 			if err != nil {
1551
-				if errdefs.IsNotFound(err) {
1551
+				if cerrdefs.IsNotFound(err) {
1552 1552
 					// Trying to link to a non-existing container is not valid, and
1553 1553
 					// should return an "invalid parameter" error. Returning a "not
1554 1554
 					// found" error here would make the client report the container's
... ...
@@ -6,10 +6,10 @@ import (
6 6
 	"testing"
7 7
 	"time"
8 8
 
9
+	cerrdefs "github.com/containerd/errdefs"
9 10
 	"github.com/docker/docker/api/types/backend"
10 11
 	containertypes "github.com/docker/docker/api/types/container"
11 12
 	"github.com/docker/docker/container"
12
-	"github.com/docker/docker/errdefs"
13 13
 	"gotest.tools/v3/assert"
14 14
 	is "gotest.tools/v3/assert/cmp"
15 15
 )
... ...
@@ -75,7 +75,7 @@ func TestContainerDelete(t *testing.T) {
75 75
 			d.containers.Add(c.ID, c)
76 76
 
77 77
 			err := d.ContainerRm(c.ID, &backend.ContainerRmConfig{ForceRemove: false})
78
-			assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
78
+			assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
79 79
 			assert.Check(t, is.ErrorContains(err, tc.errMsg))
80 80
 		})
81 81
 	}
... ...
@@ -6,13 +6,13 @@ import (
6 6
 	"io"
7 7
 	"runtime"
8 8
 
9
+	cerrdefs "github.com/containerd/errdefs"
9 10
 	"github.com/containerd/log"
10 11
 	"github.com/containerd/platforms"
11 12
 	"github.com/distribution/reference"
12 13
 	"github.com/docker/docker/api/types/backend"
13 14
 	"github.com/docker/docker/api/types/registry"
14 15
 	"github.com/docker/docker/builder"
15
-	"github.com/docker/docker/errdefs"
16 16
 	"github.com/docker/docker/image"
17 17
 	"github.com/docker/docker/layer"
18 18
 	"github.com/docker/docker/pkg/progress"
... ...
@@ -166,7 +166,7 @@ func (i *ImageService) pullForBuilder(ctx context.Context, name string, authConf
166 166
 	}
167 167
 
168 168
 	img, err := i.GetImage(ctx, name, backend.GetImageOpts{Platform: platform})
169
-	if errdefs.IsNotFound(err) && img != nil && platform != nil {
169
+	if cerrdefs.IsNotFound(err) && img != nil && platform != nil {
170 170
 		imgPlat := ocispec.Platform{
171 171
 			OS:           img.OS,
172 172
 			Architecture: img.BaseImgArch(),
... ...
@@ -211,7 +211,7 @@ func (i *ImageService) GetImageAndReleasableLayer(ctx context.Context, refOrID s
211 211
 		if err != nil && opts.PullOption == backend.PullOptionNoPull {
212 212
 			return nil, nil, err
213 213
 		}
214
-		if err != nil && !errdefs.IsNotFound(err) {
214
+		if err != nil && !cerrdefs.IsNotFound(err) {
215 215
 			return nil, nil, err
216 216
 		}
217 217
 		if img != nil {
... ...
@@ -6,6 +6,7 @@ import (
6 6
 	"strconv"
7 7
 	"time"
8 8
 
9
+	cerrdefs "github.com/containerd/errdefs"
9 10
 	"github.com/containerd/log"
10 11
 	"github.com/distribution/reference"
11 12
 	"github.com/docker/docker/api/types/events"
... ...
@@ -162,7 +163,7 @@ func imageDeleteFailed(ref string, err error) bool {
162 162
 	switch {
163 163
 	case err == nil:
164 164
 		return false
165
-	case errdefs.IsConflict(err), errors.Is(err, context.Canceled), errors.Is(err, context.DeadlineExceeded):
165
+	case cerrdefs.IsConflict(err), errors.Is(err, context.Canceled), errors.Is(err, context.DeadlineExceeded):
166 166
 		return true
167 167
 	default:
168 168
 		log.G(context.TODO()).Warnf("failed to prune image %s: %v", ref, err)
... ...
@@ -7,13 +7,13 @@ import (
7 7
 
8 8
 	"github.com/containerd/containerd/v2/core/leases"
9 9
 	"github.com/containerd/containerd/v2/pkg/namespaces"
10
+	cerrdefs "github.com/containerd/errdefs"
10 11
 	"github.com/containerd/log"
11 12
 	"github.com/distribution/reference"
12 13
 	"github.com/docker/docker/api/types/backend"
13 14
 	"github.com/docker/docker/api/types/registry"
14 15
 	"github.com/docker/docker/distribution"
15 16
 	progressutils "github.com/docker/docker/distribution/utils"
16
-	"github.com/docker/docker/errdefs"
17 17
 	"github.com/docker/docker/internal/metrics"
18 18
 	"github.com/docker/docker/pkg/progress"
19 19
 	"github.com/docker/docker/pkg/streamformatter"
... ...
@@ -43,7 +43,7 @@ func (i *ImageService) PullImage(ctx context.Context, ref reference.Named, platf
43 43
 
44 44
 		// Note that this is a special case where GetImage returns both an image
45 45
 		// and an error: https://github.com/docker/docker/blob/v20.10.7/daemon/images/image.go#L175-L183
46
-		if errdefs.IsNotFound(err) && img != nil {
46
+		if cerrdefs.IsNotFound(err) && img != nil {
47 47
 			po := streamformatter.NewJSONProgressOutput(outStream, false)
48 48
 			progress.Messagef(po, "", `WARNING: %s`, err.Error())
49 49
 			log.G(ctx).WithError(err).WithField("image", reference.FamiliarName(ref)).Warn("ignoring platform mismatch on single-arch image")
... ...
@@ -17,7 +17,6 @@ import (
17 17
 	containertypes "github.com/docker/docker/api/types/container"
18 18
 	"github.com/docker/docker/api/types/system"
19 19
 	"github.com/docker/docker/daemon/config"
20
-	"github.com/docker/docker/errdefs"
21 20
 	"github.com/docker/docker/pkg/rootless"
22 21
 	"github.com/docker/docker/pkg/sysinfo"
23 22
 	"github.com/pkg/errors"
... ...
@@ -180,7 +179,7 @@ func (daemon *Daemon) fillPlatformVersion(ctx context.Context, v *types.Version,
180 180
 	}
181 181
 
182 182
 	if err := daemon.fillRootlessVersion(ctx, v); err != nil {
183
-		if errdefs.IsContext(err) {
183
+		if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
184 184
 			return err
185 185
 		}
186 186
 		log.G(ctx).WithError(err).Warn("Failed to fill rootless version")
... ...
@@ -207,7 +206,7 @@ func (daemon *Daemon) populateInitCommit(ctx context.Context, v *system.Info, cf
207 207
 
208 208
 	rv, err := exec.CommandContext(ctx, initBinary, "--version").Output()
209 209
 	if err != nil {
210
-		if errdefs.IsContext(err) {
210
+		if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
211 211
 			return err
212 212
 		}
213 213
 		log.G(ctx).WithError(err).Warnf("Failed to retrieve %s version", initBinary)
... ...
@@ -262,7 +261,7 @@ func (daemon *Daemon) fillRootlessVersion(ctx context.Context, v *types.Version)
262 262
 		err = func() error {
263 263
 			rv, err := exec.CommandContext(ctx, "slirp4netns", "--version").Output()
264 264
 			if err != nil {
265
-				if errdefs.IsContext(err) {
265
+				if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
266 266
 					return err
267 267
 				}
268 268
 				log.G(ctx).WithError(err).Warn("Failed to retrieve slirp4netns version")
... ...
@@ -290,7 +289,7 @@ func (daemon *Daemon) fillRootlessVersion(ctx context.Context, v *types.Version)
290 290
 		err = func() error {
291 291
 			out, err := exec.CommandContext(ctx, "vpnkit", "--version").Output()
292 292
 			if err != nil {
293
-				if errdefs.IsContext(err) {
293
+				if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
294 294
 					return err
295 295
 				}
296 296
 				log.G(ctx).WithError(err).Warn("Failed to retrieve vpnkit version")
... ...
@@ -426,7 +425,7 @@ func noNewPrivileges(cfg *config.Config) bool {
426 426
 func (daemon *Daemon) populateContainerdCommit(ctx context.Context, v *system.Commit) error {
427 427
 	rv, err := daemon.containerd.Version(ctx)
428 428
 	if err != nil {
429
-		if errdefs.IsContext(err) {
429
+		if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
430 430
 			return err
431 431
 		}
432 432
 		log.G(ctx).WithError(err).Warnf("Failed to retrieve containerd version")
... ...
@@ -439,7 +438,7 @@ func (daemon *Daemon) populateContainerdCommit(ctx context.Context, v *system.Co
439 439
 func (daemon *Daemon) populateContainerdVersion(ctx context.Context, v *types.Version) error {
440 440
 	rv, err := daemon.containerd.Version(ctx)
441 441
 	if err != nil {
442
-		if errdefs.IsContext(err) {
442
+		if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
443 443
 			return err
444 444
 		}
445 445
 		log.G(ctx).WithError(err).Warn("Failed to retrieve containerd version")
... ...
@@ -480,7 +479,7 @@ func populateInitVersion(ctx context.Context, cfg *configStore, v *types.Version
480 480
 
481 481
 	rv, err := exec.CommandContext(ctx, initBinary, "--version").Output()
482 482
 	if err != nil {
483
-		if errdefs.IsContext(err) {
483
+		if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
484 484
 			return err
485 485
 		}
486 486
 		log.G(ctx).WithError(err).Warnf("Failed to retrieve %s version", initBinary)
... ...
@@ -8,6 +8,7 @@ import (
8 8
 	"syscall"
9 9
 	"time"
10 10
 
11
+	cerrdefs "github.com/containerd/errdefs"
11 12
 	"github.com/containerd/log"
12 13
 	containertypes "github.com/docker/docker/api/types/container"
13 14
 	"github.com/docker/docker/api/types/events"
... ...
@@ -108,7 +109,7 @@ func (daemon *Daemon) killWithSignal(container *containerpkg.Container, stopSign
108 108
 	}
109 109
 
110 110
 	if err := task.Kill(context.Background(), stopSignal); err != nil {
111
-		if errdefs.IsNotFound(err) {
111
+		if cerrdefs.IsNotFound(err) {
112 112
 			unpause = false
113 113
 			log.G(context.TODO()).WithFields(log.Fields{
114 114
 				"error":     err,
... ...
@@ -205,7 +206,7 @@ func (daemon *Daemon) Kill(container *containerpkg.Container) error {
205 205
 // killPossiblyDeadProcess is a wrapper around killSig() suppressing "no such process" error.
206 206
 func (daemon *Daemon) killPossiblyDeadProcess(container *containerpkg.Container, sig syscall.Signal) error {
207 207
 	err := daemon.killWithSignal(container, sig)
208
-	if errdefs.IsNotFound(err) {
208
+	if cerrdefs.IsNotFound(err) {
209 209
 		err = errNoSuchProcess{container.GetPID(), sig}
210 210
 		log.G(context.TODO()).Debug(err)
211 211
 		return err
... ...
@@ -9,6 +9,7 @@ import (
9 9
 	"strings"
10 10
 	"sync"
11 11
 
12
+	cerrdefs "github.com/containerd/errdefs"
12 13
 	"github.com/containerd/log"
13 14
 	"github.com/docker/docker/api/types/backend"
14 15
 	containertypes "github.com/docker/docker/api/types/container"
... ...
@@ -244,7 +245,7 @@ func (daemon *Daemon) filterByNameIDMatches(view *container.View, filter *listCo
244 244
 	for id := range matches {
245 245
 		c, err := view.Get(id)
246 246
 		if err != nil {
247
-			if errdefs.IsNotFound(err) {
247
+			if cerrdefs.IsNotFound(err) {
248 248
 				// ignore error
249 249
 				continue
250 250
 			}
... ...
@@ -375,7 +376,7 @@ func (daemon *Daemon) foldFilter(ctx context.Context, view *container.View, conf
375 375
 
376 376
 func idOrNameFilter(view *container.View, value string) (*container.Snapshot, error) {
377 377
 	filter, err := view.Get(value)
378
-	if err != nil && errdefs.IsNotFound(err) {
378
+	if err != nil && cerrdefs.IsNotFound(err) {
379 379
 		// Try name search instead
380 380
 		found := ""
381 381
 		searchName := strings.TrimPrefix(value, "/")
... ...
@@ -634,7 +635,7 @@ func (daemon *Daemon) refreshImage(ctx context.Context, s *container.Snapshot) *
634 634
 	// reason. Update the Image to the specific ID of the original image it
635 635
 	// resolved to when the container was created.
636 636
 	if err != nil {
637
-		if !errdefs.IsNotFound(err) {
637
+		if !cerrdefs.IsNotFound(err) {
638 638
 			log.G(ctx).WithFields(log.Fields{
639 639
 				"error":       err,
640 640
 				"containerID": c.ID,
... ...
@@ -6,12 +6,12 @@ import (
6 6
 	"strings"
7 7
 	"time"
8 8
 
9
+	cerrdefs "github.com/containerd/errdefs"
9 10
 	"github.com/containerd/log"
10 11
 	"github.com/docker/docker/api/types/backend"
11 12
 	"github.com/docker/docker/api/types/events"
12 13
 	"github.com/docker/docker/container"
13 14
 	"github.com/docker/docker/daemon/config"
14
-	"github.com/docker/docker/errdefs"
15 15
 	"github.com/docker/docker/internal/metrics"
16 16
 	libcontainerdtypes "github.com/docker/docker/libcontainerd/types"
17 17
 	"github.com/docker/docker/restartmanager"
... ...
@@ -250,7 +250,7 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei
250 250
 		if !c.Running {
251 251
 			ctr, err := daemon.containerd.LoadContainer(context.Background(), c.ID)
252 252
 			if err != nil {
253
-				if errdefs.IsNotFound(err) {
253
+				if cerrdefs.IsNotFound(err) {
254 254
 					// The container was started by not-docker and so could have been deleted by
255 255
 					// not-docker before we got around to loading it from containerd.
256 256
 					log.G(context.TODO()).WithFields(log.Fields{
... ...
@@ -263,7 +263,7 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei
263 263
 			}
264 264
 			tsk, err := ctr.Task(context.Background())
265 265
 			if err != nil {
266
-				if errdefs.IsNotFound(err) {
266
+				if cerrdefs.IsNotFound(err) {
267 267
 					log.G(context.TODO()).WithFields(log.Fields{
268 268
 						"error":     err,
269 269
 						"container": c.ID,
... ...
@@ -5,6 +5,7 @@ import (
5 5
 	"fmt"
6 6
 	"strings"
7 7
 
8
+	cerrdefs "github.com/containerd/errdefs"
8 9
 	"github.com/containerd/log"
9 10
 	"github.com/docker/docker/container"
10 11
 	"github.com/docker/docker/daemon/names"
... ...
@@ -68,7 +69,7 @@ func (daemon *Daemon) reserveName(id, name string) (string, error) {
68 68
 	}
69 69
 
70 70
 	if err := daemon.containersReplica.ReserveName(name, id); err != nil {
71
-		if errdefs.IsConflict(err) {
71
+		if cerrdefs.IsConflict(err) {
72 72
 			id, err := daemon.containersReplica.Snapshot().GetID(name)
73 73
 			if err != nil {
74 74
 				log.G(context.TODO()).Errorf("got unexpected error while looking up reserved name: %v", err)
... ...
@@ -94,7 +95,7 @@ func (daemon *Daemon) generateAndReserveName(id string) (string, error) {
94 94
 		}
95 95
 
96 96
 		if err := daemon.containersReplica.ReserveName(name, id); err != nil {
97
-			if errdefs.IsConflict(err) {
97
+			if cerrdefs.IsConflict(err) {
98 98
 				continue
99 99
 			}
100 100
 			return "", err
... ...
@@ -12,9 +12,9 @@ import (
12 12
 	runcoptions "github.com/containerd/containerd/api/types/runc/options"
13 13
 	runtimeoptions "github.com/containerd/containerd/api/types/runtimeoptions/v1"
14 14
 	"github.com/containerd/containerd/v2/plugins"
15
+	cerrdefs "github.com/containerd/errdefs"
15 16
 	"github.com/docker/docker/api/types/system"
16 17
 	"github.com/docker/docker/daemon/config"
17
-	"github.com/docker/docker/errdefs"
18 18
 	"github.com/google/go-cmp/cmp/cmpopts"
19 19
 	"google.golang.org/protobuf/proto"
20 20
 	"gotest.tools/v3/assert"
... ...
@@ -341,7 +341,7 @@ func TestGetRuntime(t *testing.T) {
341 341
 			} else {
342 342
 				assert.Check(t, is.Equal(shim, ""))
343 343
 				assert.Check(t, is.Nil(opts))
344
-				assert.Check(t, errdefs.IsInvalidParameter(err), "[%T] %[1]v", err)
344
+				assert.Check(t, cerrdefs.IsInvalidArgument(err), "[%T] %[1]v", err)
345 345
 			}
346 346
 		})
347 347
 	}
... ...
@@ -3,9 +3,9 @@ package daemon // import "github.com/docker/docker/daemon"
3 3
 import (
4 4
 	"context"
5 5
 
6
+	cerrdefs "github.com/containerd/errdefs"
6 7
 	containertypes "github.com/docker/docker/api/types/container"
7 8
 	"github.com/docker/docker/container"
8
-	"github.com/docker/docker/errdefs"
9 9
 	"github.com/docker/docker/internal/platform"
10 10
 )
11 11
 
... ...
@@ -20,7 +20,7 @@ func (daemon *Daemon) stats(c *container.Container) (*containertypes.StatsRespon
20 20
 	// Obtain the stats from HCS via libcontainerd
21 21
 	stats, err := task.Stats(context.Background())
22 22
 	if err != nil {
23
-		if errdefs.IsNotFound(err) {
23
+		if cerrdefs.IsNotFound(err) {
24 24
 			return nil, containerNotFound(c.ID)
25 25
 		}
26 26
 		return nil, err
... ...
@@ -4,6 +4,7 @@ import (
4 4
 	"context"
5 5
 	"fmt"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	"github.com/docker/docker/api/types/container"
8 9
 	"github.com/docker/docker/api/types/events"
9 10
 	"github.com/docker/docker/errdefs"
... ...
@@ -86,7 +87,7 @@ func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) erro
86 86
 	isRestarting := ctr.Restarting
87 87
 	tsk, err := ctr.GetRunningTask()
88 88
 	ctr.Unlock()
89
-	if errdefs.IsConflict(err) || isRestarting {
89
+	if cerrdefs.IsConflict(err) || isRestarting {
90 90
 		return nil
91 91
 	}
92 92
 	if err != nil {
... ...
@@ -91,7 +91,7 @@ func (e unsupportedMediaTypeError) Error() string {
91 91
 // log at info level.
92 92
 func translatePullError(err error, ref reference.Named) error {
93 93
 	// FIXME(thaJeztah): cleanup error and context handling in this package, as it's really messy.
94
-	if errdefs.IsContext(err) {
94
+	if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
95 95
 		return err
96 96
 	}
97 97
 	switch v := err.(type) {
... ...
@@ -118,7 +118,7 @@ func translatePullError(err error, ref reference.Named) error {
118 118
 // as a result of this error.
119 119
 func continueOnError(err error, mirrorEndpoint bool) bool {
120 120
 	// FIXME(thaJeztah): cleanup error and context handling in this package, as it's really messy.
121
-	if errdefs.IsContext(err) {
121
+	if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
122 122
 		return false
123 123
 	}
124 124
 	switch v := err.(type) {
... ...
@@ -8,7 +8,6 @@ import (
8 8
 	"github.com/distribution/reference"
9 9
 	"github.com/docker/docker/api"
10 10
 	"github.com/docker/docker/api/types/events"
11
-	"github.com/docker/docker/errdefs"
12 11
 	refstore "github.com/docker/docker/reference"
13 12
 	"github.com/docker/docker/registry"
14 13
 	"github.com/opencontainers/go-digest"
... ...
@@ -134,7 +133,7 @@ func pullEndpoints(ctx context.Context, registryService RegistryResolver, ref re
134 134
 				continue
135 135
 			}
136 136
 			// FIXME(thaJeztah): cleanup error and context handling in this package, as it's really messy.
137
-			if errdefs.IsContext(err) {
137
+			if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
138 138
 				log.G(ctx).WithError(err).Info("Not continuing with pull after error")
139 139
 			} else {
140 140
 				log.G(ctx).WithError(err).Error("Not continuing with pull after error")
... ...
@@ -4,13 +4,13 @@ import (
4 4
 	"bufio"
5 5
 	"compress/gzip"
6 6
 	"context"
7
+	"errors"
7 8
 	"fmt"
8 9
 	"io"
9 10
 
10 11
 	"github.com/containerd/log"
11 12
 	"github.com/distribution/reference"
12 13
 	"github.com/docker/docker/api/types/events"
13
-	"github.com/docker/docker/errdefs"
14 14
 	"github.com/docker/docker/pkg/progress"
15 15
 )
16 16
 
... ...
@@ -72,7 +72,7 @@ func Push(ctx context.Context, ref reference.Named, config *ImagePushConfig) err
72 72
 			}
73 73
 
74 74
 			// FIXME(thaJeztah): cleanup error and context handling in this package, as it's really messy.
75
-			if errdefs.IsContext(err) {
75
+			if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
76 76
 				log.G(ctx).WithError(err).Info("Not continuing with push after error")
77 77
 			} else {
78 78
 				log.G(ctx).WithError(err).Error("Not continuing with push after error")
... ...
@@ -1,6 +1,10 @@
1 1
 package errdefs
2 2
 
3
-import "context"
3
+import (
4
+	"context"
5
+
6
+	cerrdefs "github.com/containerd/errdefs"
7
+)
4 8
 
5 9
 type errNotFound struct{ error }
6 10
 
... ...
@@ -18,7 +22,7 @@ func (e errNotFound) Unwrap() error {
18 18
 // It returns the error as-is if it is either nil (no error) or already implements
19 19
 // [ErrNotFound],
20 20
 func NotFound(err error) error {
21
-	if err == nil || IsNotFound(err) {
21
+	if err == nil || cerrdefs.IsNotFound(err) {
22 22
 		return err
23 23
 	}
24 24
 	return errNotFound{err}
... ...
@@ -40,7 +44,7 @@ func (e errInvalidParameter) Unwrap() error {
40 40
 // It returns the error as-is if it is either nil (no error) or already implements
41 41
 // [ErrInvalidParameter],
42 42
 func InvalidParameter(err error) error {
43
-	if err == nil || IsInvalidParameter(err) {
43
+	if err == nil || cerrdefs.IsInvalidArgument(err) {
44 44
 		return err
45 45
 	}
46 46
 	return errInvalidParameter{err}
... ...
@@ -62,7 +66,7 @@ func (e errConflict) Unwrap() error {
62 62
 // It returns the error as-is if it is either nil (no error) or already implements
63 63
 // [ErrConflict],
64 64
 func Conflict(err error) error {
65
-	if err == nil || IsConflict(err) {
65
+	if err == nil || cerrdefs.IsConflict(err) {
66 66
 		return err
67 67
 	}
68 68
 	return errConflict{err}
... ...
@@ -84,7 +88,7 @@ func (e errUnauthorized) Unwrap() error {
84 84
 // It returns the error as-is if it is either nil (no error) or already implements
85 85
 // [ErrUnauthorized],
86 86
 func Unauthorized(err error) error {
87
-	if err == nil || IsUnauthorized(err) {
87
+	if err == nil || cerrdefs.IsUnauthorized(err) {
88 88
 		return err
89 89
 	}
90 90
 	return errUnauthorized{err}
... ...
@@ -106,7 +110,7 @@ func (e errUnavailable) Unwrap() error {
106 106
 // It returns the error as-is if it is either nil (no error) or already implements
107 107
 // [ErrUnavailable],
108 108
 func Unavailable(err error) error {
109
-	if err == nil || IsUnavailable(err) {
109
+	if err == nil || cerrdefs.IsUnavailable(err) {
110 110
 		return err
111 111
 	}
112 112
 	return errUnavailable{err}
... ...
@@ -128,7 +132,7 @@ func (e errForbidden) Unwrap() error {
128 128
 // It returns the error as-is if it is either nil (no error) or already implements
129 129
 // [ErrForbidden],
130 130
 func Forbidden(err error) error {
131
-	if err == nil || IsForbidden(err) {
131
+	if err == nil || cerrdefs.IsPermissionDenied(err) {
132 132
 		return err
133 133
 	}
134 134
 	return errForbidden{err}
... ...
@@ -150,7 +154,7 @@ func (e errSystem) Unwrap() error {
150 150
 // It returns the error as-is if it is either nil (no error) or already implements
151 151
 // [ErrSystem],
152 152
 func System(err error) error {
153
-	if err == nil || IsSystem(err) {
153
+	if err == nil || cerrdefs.IsInternal(err) {
154 154
 		return err
155 155
 	}
156 156
 	return errSystem{err}
... ...
@@ -172,7 +176,7 @@ func (e errNotModified) Unwrap() error {
172 172
 // It returns the error as-is if it is either nil (no error) or already implements
173 173
 // [NotModified],
174 174
 func NotModified(err error) error {
175
-	if err == nil || IsNotModified(err) {
175
+	if err == nil || cerrdefs.IsNotModified(err) {
176 176
 		return err
177 177
 	}
178 178
 	return errNotModified{err}
... ...
@@ -194,7 +198,7 @@ func (e errNotImplemented) Unwrap() error {
194 194
 // It returns the error as-is if it is either nil (no error) or already implements
195 195
 // [ErrNotImplemented],
196 196
 func NotImplemented(err error) error {
197
-	if err == nil || IsNotImplemented(err) {
197
+	if err == nil || cerrdefs.IsNotImplemented(err) {
198 198
 		return err
199 199
 	}
200 200
 	return errNotImplemented{err}
... ...
@@ -216,7 +220,7 @@ func (e errUnknown) Unwrap() error {
216 216
 // It returns the error as-is if it is either nil (no error) or already implements
217 217
 // [ErrUnknown],
218 218
 func Unknown(err error) error {
219
-	if err == nil || IsUnknown(err) {
219
+	if err == nil || cerrdefs.IsUnknown(err) {
220 220
 		return err
221 221
 	}
222 222
 	return errUnknown{err}
... ...
@@ -238,7 +242,7 @@ func (e errCancelled) Unwrap() error {
238 238
 // It returns the error as-is if it is either nil (no error) or already implements
239 239
 // [ErrCancelled],
240 240
 func Cancelled(err error) error {
241
-	if err == nil || IsCancelled(err) {
241
+	if err == nil || cerrdefs.IsCanceled(err) {
242 242
 		return err
243 243
 	}
244 244
 	return errCancelled{err}
... ...
@@ -260,7 +264,7 @@ func (e errDeadline) Unwrap() error {
260 260
 // It returns the error as-is if it is either nil (no error) or already implements
261 261
 // [ErrDeadline],
262 262
 func Deadline(err error) error {
263
-	if err == nil || IsDeadline(err) {
263
+	if err == nil || cerrdefs.IsDeadlineExceeded(err) {
264 264
 		return err
265 265
 	}
266 266
 	return errDeadline{err}
... ...
@@ -282,7 +286,7 @@ func (e errDataLoss) Unwrap() error {
282 282
 // It returns the error as-is if it is either nil (no error) or already implements
283 283
 // [ErrDataLoss],
284 284
 func DataLoss(err error) error {
285
-	if err == nil || IsDataLoss(err) {
285
+	if err == nil || cerrdefs.IsDataLoss(err) {
286 286
 		return err
287 287
 	}
288 288
 	return errDataLoss{err}
... ...
@@ -4,6 +4,8 @@ import (
4 4
 	"errors"
5 5
 	"fmt"
6 6
 	"testing"
7
+
8
+	cerrdefs "github.com/containerd/errdefs"
7 9
 )
8 10
 
9 11
 var errTest = errors.New("this is a test")
... ...
@@ -13,11 +15,11 @@ type wrapped interface {
13 13
 }
14 14
 
15 15
 func TestNotFound(t *testing.T) {
16
-	if IsNotFound(errTest) {
16
+	if cerrdefs.IsNotFound(errTest) {
17 17
 		t.Fatalf("did not expect not found error, got %T", errTest)
18 18
 	}
19 19
 	e := NotFound(errTest)
20
-	if !IsNotFound(e) {
20
+	if !cerrdefs.IsNotFound(e) {
21 21
 		t.Fatalf("expected not found error, got: %T", e)
22 22
 	}
23 23
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -28,17 +30,17 @@ func TestNotFound(t *testing.T) {
28 28
 	}
29 29
 
30 30
 	wrapped := fmt.Errorf("foo: %w", e)
31
-	if !IsNotFound(wrapped) {
31
+	if !cerrdefs.IsNotFound(wrapped) {
32 32
 		t.Fatalf("expected not found error, got: %T", wrapped)
33 33
 	}
34 34
 }
35 35
 
36 36
 func TestConflict(t *testing.T) {
37
-	if IsConflict(errTest) {
37
+	if cerrdefs.IsConflict(errTest) {
38 38
 		t.Fatalf("did not expect conflict error, got %T", errTest)
39 39
 	}
40 40
 	e := Conflict(errTest)
41
-	if !IsConflict(e) {
41
+	if !cerrdefs.IsConflict(e) {
42 42
 		t.Fatalf("expected conflict error, got: %T", e)
43 43
 	}
44 44
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -49,17 +51,17 @@ func TestConflict(t *testing.T) {
49 49
 	}
50 50
 
51 51
 	wrapped := fmt.Errorf("foo: %w", e)
52
-	if !IsConflict(wrapped) {
52
+	if !cerrdefs.IsConflict(wrapped) {
53 53
 		t.Fatalf("expected conflict error, got: %T", wrapped)
54 54
 	}
55 55
 }
56 56
 
57 57
 func TestForbidden(t *testing.T) {
58
-	if IsForbidden(errTest) {
58
+	if cerrdefs.IsPermissionDenied(errTest) {
59 59
 		t.Fatalf("did not expect forbidden error, got %T", errTest)
60 60
 	}
61 61
 	e := Forbidden(errTest)
62
-	if !IsForbidden(e) {
62
+	if !cerrdefs.IsPermissionDenied(e) {
63 63
 		t.Fatalf("expected forbidden error, got: %T", e)
64 64
 	}
65 65
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -70,17 +72,17 @@ func TestForbidden(t *testing.T) {
70 70
 	}
71 71
 
72 72
 	wrapped := fmt.Errorf("foo: %w", e)
73
-	if !IsForbidden(wrapped) {
73
+	if !cerrdefs.IsPermissionDenied(wrapped) {
74 74
 		t.Fatalf("expected forbidden error, got: %T", wrapped)
75 75
 	}
76 76
 }
77 77
 
78 78
 func TestInvalidParameter(t *testing.T) {
79
-	if IsInvalidParameter(errTest) {
79
+	if cerrdefs.IsInvalidArgument(errTest) {
80 80
 		t.Fatalf("did not expect invalid argument error, got %T", errTest)
81 81
 	}
82 82
 	e := InvalidParameter(errTest)
83
-	if !IsInvalidParameter(e) {
83
+	if !cerrdefs.IsInvalidArgument(e) {
84 84
 		t.Fatalf("expected invalid argument error, got %T", e)
85 85
 	}
86 86
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -91,17 +93,17 @@ func TestInvalidParameter(t *testing.T) {
91 91
 	}
92 92
 
93 93
 	wrapped := fmt.Errorf("foo: %w", e)
94
-	if !IsInvalidParameter(wrapped) {
94
+	if !cerrdefs.IsInvalidArgument(wrapped) {
95 95
 		t.Fatalf("expected invalid argument error, got: %T", wrapped)
96 96
 	}
97 97
 }
98 98
 
99 99
 func TestNotImplemented(t *testing.T) {
100
-	if IsNotImplemented(errTest) {
100
+	if cerrdefs.IsNotImplemented(errTest) {
101 101
 		t.Fatalf("did not expect not implemented error, got %T", errTest)
102 102
 	}
103 103
 	e := NotImplemented(errTest)
104
-	if !IsNotImplemented(e) {
104
+	if !cerrdefs.IsNotImplemented(e) {
105 105
 		t.Fatalf("expected not implemented error, got %T", e)
106 106
 	}
107 107
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -112,17 +114,17 @@ func TestNotImplemented(t *testing.T) {
112 112
 	}
113 113
 
114 114
 	wrapped := fmt.Errorf("foo: %w", e)
115
-	if !IsNotImplemented(wrapped) {
115
+	if !cerrdefs.IsNotImplemented(wrapped) {
116 116
 		t.Fatalf("expected not implemented error, got: %T", wrapped)
117 117
 	}
118 118
 }
119 119
 
120 120
 func TestNotModified(t *testing.T) {
121
-	if IsNotModified(errTest) {
121
+	if cerrdefs.IsNotModified(errTest) {
122 122
 		t.Fatalf("did not expect not modified error, got %T", errTest)
123 123
 	}
124 124
 	e := NotModified(errTest)
125
-	if !IsNotModified(e) {
125
+	if !cerrdefs.IsNotModified(e) {
126 126
 		t.Fatalf("expected not modified error, got %T", e)
127 127
 	}
128 128
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -133,17 +135,17 @@ func TestNotModified(t *testing.T) {
133 133
 	}
134 134
 
135 135
 	wrapped := fmt.Errorf("foo: %w", e)
136
-	if !IsNotModified(wrapped) {
136
+	if !cerrdefs.IsNotModified(wrapped) {
137 137
 		t.Fatalf("expected not modified error, got: %T", wrapped)
138 138
 	}
139 139
 }
140 140
 
141 141
 func TestUnauthorized(t *testing.T) {
142
-	if IsUnauthorized(errTest) {
142
+	if cerrdefs.IsUnauthorized(errTest) {
143 143
 		t.Fatalf("did not expect unauthorized error, got %T", errTest)
144 144
 	}
145 145
 	e := Unauthorized(errTest)
146
-	if !IsUnauthorized(e) {
146
+	if !cerrdefs.IsUnauthorized(e) {
147 147
 		t.Fatalf("expected unauthorized error, got %T", e)
148 148
 	}
149 149
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -154,17 +156,17 @@ func TestUnauthorized(t *testing.T) {
154 154
 	}
155 155
 
156 156
 	wrapped := fmt.Errorf("foo: %w", e)
157
-	if !IsUnauthorized(wrapped) {
157
+	if !cerrdefs.IsUnauthorized(wrapped) {
158 158
 		t.Fatalf("expected unauthorized error, got: %T", wrapped)
159 159
 	}
160 160
 }
161 161
 
162 162
 func TestUnknown(t *testing.T) {
163
-	if IsUnknown(errTest) {
163
+	if cerrdefs.IsUnknown(errTest) {
164 164
 		t.Fatalf("did not expect unknown error, got %T", errTest)
165 165
 	}
166 166
 	e := Unknown(errTest)
167
-	if !IsUnknown(e) {
167
+	if !cerrdefs.IsUnknown(e) {
168 168
 		t.Fatalf("expected unknown error, got %T", e)
169 169
 	}
170 170
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -175,17 +177,17 @@ func TestUnknown(t *testing.T) {
175 175
 	}
176 176
 
177 177
 	wrapped := fmt.Errorf("foo: %w", e)
178
-	if !IsUnknown(wrapped) {
178
+	if !cerrdefs.IsUnknown(wrapped) {
179 179
 		t.Fatalf("expected unknown error, got: %T", wrapped)
180 180
 	}
181 181
 }
182 182
 
183 183
 func TestCancelled(t *testing.T) {
184
-	if IsCancelled(errTest) {
184
+	if cerrdefs.IsCanceled(errTest) {
185 185
 		t.Fatalf("did not expect cancelled error, got %T", errTest)
186 186
 	}
187 187
 	e := Cancelled(errTest)
188
-	if !IsCancelled(e) {
188
+	if !cerrdefs.IsCanceled(e) {
189 189
 		t.Fatalf("expected cancelled error, got %T", e)
190 190
 	}
191 191
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -196,17 +198,17 @@ func TestCancelled(t *testing.T) {
196 196
 	}
197 197
 
198 198
 	wrapped := fmt.Errorf("foo: %w", e)
199
-	if !IsCancelled(wrapped) {
199
+	if !cerrdefs.IsCanceled(wrapped) {
200 200
 		t.Fatalf("expected cancelled error, got: %T", wrapped)
201 201
 	}
202 202
 }
203 203
 
204 204
 func TestDeadline(t *testing.T) {
205
-	if IsDeadline(errTest) {
205
+	if cerrdefs.IsDeadlineExceeded(errTest) {
206 206
 		t.Fatalf("did not expect deadline error, got %T", errTest)
207 207
 	}
208 208
 	e := Deadline(errTest)
209
-	if !IsDeadline(e) {
209
+	if !cerrdefs.IsDeadlineExceeded(e) {
210 210
 		t.Fatalf("expected deadline error, got %T", e)
211 211
 	}
212 212
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -217,17 +219,17 @@ func TestDeadline(t *testing.T) {
217 217
 	}
218 218
 
219 219
 	wrapped := fmt.Errorf("foo: %w", e)
220
-	if !IsDeadline(wrapped) {
220
+	if !cerrdefs.IsDeadlineExceeded(wrapped) {
221 221
 		t.Fatalf("expected deadline error, got: %T", wrapped)
222 222
 	}
223 223
 }
224 224
 
225 225
 func TestDataLoss(t *testing.T) {
226
-	if IsDataLoss(errTest) {
226
+	if cerrdefs.IsDataLoss(errTest) {
227 227
 		t.Fatalf("did not expect data loss error, got %T", errTest)
228 228
 	}
229 229
 	e := DataLoss(errTest)
230
-	if !IsDataLoss(e) {
230
+	if !cerrdefs.IsDataLoss(e) {
231 231
 		t.Fatalf("expected data loss error, got %T", e)
232 232
 	}
233 233
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -238,17 +240,17 @@ func TestDataLoss(t *testing.T) {
238 238
 	}
239 239
 
240 240
 	wrapped := fmt.Errorf("foo: %w", e)
241
-	if !IsDataLoss(wrapped) {
241
+	if !cerrdefs.IsDataLoss(wrapped) {
242 242
 		t.Fatalf("expected data loss error, got: %T", wrapped)
243 243
 	}
244 244
 }
245 245
 
246 246
 func TestUnavailable(t *testing.T) {
247
-	if IsUnavailable(errTest) {
247
+	if cerrdefs.IsUnavailable(errTest) {
248 248
 		t.Fatalf("did not expect unavaillable error, got %T", errTest)
249 249
 	}
250 250
 	e := Unavailable(errTest)
251
-	if !IsUnavailable(e) {
251
+	if !cerrdefs.IsUnavailable(e) {
252 252
 		t.Fatalf("expected unavaillable error, got %T", e)
253 253
 	}
254 254
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -259,17 +261,17 @@ func TestUnavailable(t *testing.T) {
259 259
 	}
260 260
 
261 261
 	wrapped := fmt.Errorf("foo: %w", e)
262
-	if !IsUnavailable(wrapped) {
262
+	if !cerrdefs.IsUnavailable(wrapped) {
263 263
 		t.Fatalf("expected unavaillable error, got: %T", wrapped)
264 264
 	}
265 265
 }
266 266
 
267 267
 func TestSystem(t *testing.T) {
268
-	if IsSystem(errTest) {
268
+	if cerrdefs.IsInternal(errTest) {
269 269
 		t.Fatalf("did not expect system error, got %T", errTest)
270 270
 	}
271 271
 	e := System(errTest)
272
-	if !IsSystem(e) {
272
+	if !cerrdefs.IsInternal(e) {
273 273
 		t.Fatalf("expected system error, got %T", e)
274 274
 	}
275 275
 	if cause := e.(wrapped).Unwrap(); cause != errTest {
... ...
@@ -280,7 +282,7 @@ func TestSystem(t *testing.T) {
280 280
 	}
281 281
 
282 282
 	wrapped := fmt.Errorf("foo: %w", e)
283
-	if !IsSystem(wrapped) {
283
+	if !cerrdefs.IsInternal(wrapped) {
284 284
 		t.Fatalf("expected system error, got: %T", wrapped)
285 285
 	}
286 286
 }
... ...
@@ -4,7 +4,7 @@ import (
4 4
 	"fmt"
5 5
 	"testing"
6 6
 
7
-	"github.com/docker/docker/errdefs"
7
+	cerrdefs "github.com/containerd/errdefs"
8 8
 	"github.com/docker/docker/layer"
9 9
 	"gotest.tools/v3/assert"
10 10
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -47,7 +47,7 @@ func TestRestore(t *testing.T) {
47 47
 	assert.Check(t, is.Equal("def", img2.Comment))
48 48
 
49 49
 	_, err = imgStore.GetParent(ID(id1))
50
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
50
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
51 51
 	assert.ErrorContains(t, err, "failed to read metadata")
52 52
 
53 53
 	p, err := imgStore.GetParent(ID(id2))
... ...
@@ -69,7 +69,7 @@ func TestRestore(t *testing.T) {
69 69
 
70 70
 	invalidPattern := id1.Encoded()[1:6]
71 71
 	_, err = imgStore.Search(invalidPattern)
72
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
72
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
73 73
 	assert.Check(t, is.ErrorContains(err, invalidPattern))
74 74
 }
75 75
 
... ...
@@ -98,14 +98,14 @@ func TestAddDelete(t *testing.T) {
98 98
 	assert.NilError(t, err)
99 99
 
100 100
 	_, err = imgStore.Get(id1)
101
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
101
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
102 102
 	assert.ErrorContains(t, err, "failed to get digest")
103 103
 
104 104
 	_, err = imgStore.Get(id2)
105 105
 	assert.NilError(t, err)
106 106
 
107 107
 	_, err = imgStore.GetParent(id2)
108
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
108
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
109 109
 	assert.ErrorContains(t, err, "failed to read metadata")
110 110
 }
111 111
 
... ...
@@ -123,14 +123,14 @@ func TestSearchAfterDelete(t *testing.T) {
123 123
 	assert.NilError(t, err)
124 124
 
125 125
 	_, err = imgStore.Search(string(id)[:15])
126
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
126
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
127 127
 	assert.ErrorContains(t, err, "No such image")
128 128
 }
129 129
 
130 130
 func TestDeleteNotExisting(t *testing.T) {
131 131
 	imgStore := defaultImageStore(t)
132 132
 	_, err := imgStore.Delete(ID("i_dont_exists"))
133
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
133
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
134 134
 }
135 135
 
136 136
 func TestParentReset(t *testing.T) {
... ...
@@ -6,9 +6,9 @@ import (
6 6
 	"strings"
7 7
 	"testing"
8 8
 
9
+	cerrdefs "github.com/containerd/errdefs"
9 10
 	"github.com/docker/docker/api/types/filters"
10 11
 	"github.com/docker/docker/api/types/swarm"
11
-	"github.com/docker/docker/errdefs"
12 12
 	"gotest.tools/v3/assert"
13 13
 )
14 14
 
... ...
@@ -67,7 +67,7 @@ func (d *Daemon) CheckPluginRunning(ctx context.Context, plugin string) func(c *
67 67
 	return func(c *testing.T) (interface{}, string) {
68 68
 		apiclient := d.NewClientT(c)
69 69
 		resp, _, err := apiclient.PluginInspectWithRaw(ctx, plugin)
70
-		if errdefs.IsNotFound(err) {
70
+		if cerrdefs.IsNotFound(err) {
71 71
 			return false, fmt.Sprintf("%v", err)
72 72
 		}
73 73
 		assert.NilError(c, err)
... ...
@@ -80,7 +80,7 @@ func (d *Daemon) CheckPluginImage(ctx context.Context, plugin string) func(c *te
80 80
 	return func(c *testing.T) (interface{}, string) {
81 81
 		apiclient := d.NewClientT(c)
82 82
 		resp, _, err := apiclient.PluginInspectWithRaw(ctx, plugin)
83
-		if errdefs.IsNotFound(err) {
83
+		if cerrdefs.IsNotFound(err) {
84 84
 			return false, fmt.Sprintf("%v", err)
85 85
 		}
86 86
 		assert.NilError(c, err)
... ...
@@ -16,12 +16,12 @@ import (
16 16
 	"testing"
17 17
 	"time"
18 18
 
19
+	cerrdefs "github.com/containerd/errdefs"
19 20
 	"github.com/docker/docker/api/types/container"
20 21
 	"github.com/docker/docker/api/types/mount"
21 22
 	"github.com/docker/docker/api/types/network"
22 23
 	"github.com/docker/docker/client"
23 24
 	dconfig "github.com/docker/docker/daemon/config"
24
-	"github.com/docker/docker/errdefs"
25 25
 	"github.com/docker/docker/integration-cli/cli"
26 26
 	"github.com/docker/docker/integration-cli/cli/build"
27 27
 	"github.com/docker/docker/pkg/stringid"
... ...
@@ -1391,7 +1391,7 @@ func (s *DockerAPISuite) TestContainerAPIDeleteWithEmptyName(c *testing.T) {
1391 1391
 	defer apiClient.Close()
1392 1392
 
1393 1393
 	err = apiClient.ContainerRemove(testutil.GetContext(c), "", container.RemoveOptions{})
1394
-	assert.Check(c, is.ErrorType(err, errdefs.IsInvalidParameter))
1394
+	assert.Check(c, is.ErrorType(err, cerrdefs.IsInvalidArgument))
1395 1395
 	assert.Check(c, is.ErrorContains(err, "value is empty"))
1396 1396
 }
1397 1397
 
... ...
@@ -1968,7 +1968,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
1968 1968
 			// anonymous volumes are removed
1969 1969
 			default:
1970 1970
 				_, err := apiclient.VolumeInspect(ctx, mountPoint.Name)
1971
-				assert.Check(c, is.ErrorType(err, errdefs.IsNotFound))
1971
+				assert.Check(c, is.ErrorType(err, cerrdefs.IsNotFound))
1972 1972
 			}
1973 1973
 		})
1974 1974
 	}
... ...
@@ -18,10 +18,10 @@ import (
18 18
 	"github.com/cloudflare/cfssl/csr"
19 19
 	"github.com/cloudflare/cfssl/helpers"
20 20
 	"github.com/cloudflare/cfssl/initca"
21
+	cerrdefs "github.com/containerd/errdefs"
21 22
 	"github.com/docker/docker/api/types/container"
22 23
 	"github.com/docker/docker/api/types/network"
23 24
 	"github.com/docker/docker/api/types/swarm"
24
-	"github.com/docker/docker/errdefs"
25 25
 	"github.com/docker/docker/integration-cli/checker"
26 26
 	"github.com/docker/docker/integration-cli/daemon"
27 27
 	"github.com/docker/docker/testutil"
... ...
@@ -1031,5 +1031,5 @@ func (s *DockerSwarmSuite) TestAPINetworkInspectWithScope(c *testing.T) {
1031 1031
 	assert.Check(c, is.Equal(resp.ID, nw.ID))
1032 1032
 
1033 1033
 	_, err = apiclient.NetworkInspect(ctx, name, network.InspectOptions{Scope: "local"})
1034
-	assert.Check(c, is.ErrorType(err, errdefs.IsNotFound))
1034
+	assert.Check(c, is.ErrorType(err, cerrdefs.IsNotFound))
1035 1035
 }
... ...
@@ -13,12 +13,12 @@ import (
13 13
 	"testing"
14 14
 	"time"
15 15
 
16
+	cerrdefs "github.com/containerd/errdefs"
16 17
 	"github.com/docker/docker/api/types/build"
17 18
 	"github.com/docker/docker/api/types/container"
18 19
 	"github.com/docker/docker/api/types/events"
19 20
 	"github.com/docker/docker/api/types/filters"
20 21
 	"github.com/docker/docker/api/types/image"
21
-	"github.com/docker/docker/errdefs"
22 22
 	"github.com/docker/docker/pkg/jsonmessage"
23 23
 	"github.com/docker/docker/testutil"
24 24
 	"github.com/docker/docker/testutil/fakecontext"
... ...
@@ -690,7 +690,7 @@ func TestBuildPlatformInvalid(t *testing.T) {
690 690
 	})
691 691
 
692 692
 	assert.Check(t, is.ErrorContains(err, "unknown operating system or architecture"))
693
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
693
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
694 694
 }
695 695
 
696 696
 // TestBuildWorkdirNoCacheMiss is a regression test for https://github.com/moby/moby/issues/47627
... ...
@@ -8,11 +8,11 @@ import (
8 8
 	"testing"
9 9
 	"time"
10 10
 
11
+	cerrdefs "github.com/containerd/errdefs"
11 12
 	"github.com/docker/docker/api/types/container"
12 13
 	"github.com/docker/docker/api/types/filters"
13 14
 	swarmtypes "github.com/docker/docker/api/types/swarm"
14 15
 	"github.com/docker/docker/client"
15
-	"github.com/docker/docker/errdefs"
16 16
 	"github.com/docker/docker/integration/internal/swarm"
17 17
 	"github.com/docker/docker/pkg/stdcopy"
18 18
 	"github.com/docker/docker/testutil"
... ...
@@ -147,11 +147,11 @@ func TestConfigsCreateAndDelete(t *testing.T) {
147 147
 	assert.NilError(t, err)
148 148
 
149 149
 	_, _, err = c.ConfigInspectWithRaw(ctx, configID)
150
-	assert.Check(t, errdefs.IsNotFound(err))
150
+	assert.Check(t, cerrdefs.IsNotFound(err))
151 151
 	assert.Check(t, is.ErrorContains(err, configID))
152 152
 
153 153
 	err = c.ConfigRemove(ctx, "non-existing")
154
-	assert.Check(t, errdefs.IsNotFound(err))
154
+	assert.Check(t, cerrdefs.IsNotFound(err))
155 155
 	assert.Check(t, is.ErrorContains(err, "non-existing"))
156 156
 
157 157
 	testName = "test_secret_with_labels_" + t.Name()
... ...
@@ -216,7 +216,7 @@ func TestConfigsUpdate(t *testing.T) {
216 216
 	// this test will produce an error in func UpdateConfig
217 217
 	insp.Spec.Data = []byte("TESTINGDATA2")
218 218
 	err = c.ConfigUpdate(ctx, configID, insp.Version, insp.Spec)
219
-	assert.Check(t, errdefs.IsInvalidParameter(err))
219
+	assert.Check(t, cerrdefs.IsInvalidArgument(err))
220 220
 	assert.Check(t, is.ErrorContains(err, "only updates to Labels are allowed"))
221 221
 }
222 222
 
... ...
@@ -11,9 +11,9 @@ import (
11 11
 	"strings"
12 12
 	"testing"
13 13
 
14
+	cerrdefs "github.com/containerd/errdefs"
14 15
 	"github.com/docker/docker/api/types/build"
15 16
 	containertypes "github.com/docker/docker/api/types/container"
16
-	"github.com/docker/docker/errdefs"
17 17
 	"github.com/docker/docker/integration/internal/container"
18 18
 	"github.com/docker/docker/pkg/jsonmessage"
19 19
 	"github.com/docker/docker/testutil/fakecontext"
... ...
@@ -30,7 +30,7 @@ func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
30 30
 	cid := container.Create(ctx, t, apiClient)
31 31
 
32 32
 	_, _, err := apiClient.CopyFromContainer(ctx, cid, "/dne")
33
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
33
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
34 34
 	assert.Check(t, is.ErrorContains(err, "Could not find the file /dne in container "+cid))
35 35
 }
36 36
 
... ...
@@ -58,7 +58,7 @@ func TestCopyToContainerPathDoesNotExist(t *testing.T) {
58 58
 	cid := container.Create(ctx, t, apiClient)
59 59
 
60 60
 	err := apiClient.CopyToContainer(ctx, cid, "/dne", nil, containertypes.CopyToContainerOptions{})
61
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
61
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
62 62
 	assert.Check(t, is.ErrorContains(err, "Could not find the file /dne in container "+cid))
63 63
 }
64 64
 
... ...
@@ -11,11 +11,11 @@ import (
11 11
 	"time"
12 12
 
13 13
 	containerd "github.com/containerd/containerd/v2/client"
14
+	cerrdefs "github.com/containerd/errdefs"
14 15
 	"github.com/docker/docker/api/types/container"
15 16
 	"github.com/docker/docker/api/types/network"
16 17
 	"github.com/docker/docker/api/types/versions"
17 18
 	"github.com/docker/docker/client"
18
-	"github.com/docker/docker/errdefs"
19 19
 	testContainer "github.com/docker/docker/integration/internal/container"
20 20
 	net "github.com/docker/docker/integration/internal/network"
21 21
 	"github.com/docker/docker/oci"
... ...
@@ -66,7 +66,7 @@ func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
66 66
 				"",
67 67
 			)
68 68
 			assert.Check(t, is.ErrorContains(err, tc.expectedError))
69
-			assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
69
+			assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
70 70
 		})
71 71
 	}
72 72
 }
... ...
@@ -104,13 +104,13 @@ func TestCreateByImageID(t *testing.T) {
104 104
 		{
105 105
 			doc:             "image with ID and algorithm as tag",
106 106
 			image:           "busybox:" + imgIDWithAlgorithm,
107
-			expectedErrType: errdefs.IsInvalidParameter,
107
+			expectedErrType: cerrdefs.IsInvalidArgument,
108 108
 			expectedErr:     "Error response from daemon: invalid reference format",
109 109
 		},
110 110
 		{
111 111
 			doc:             "image with ID as tag",
112 112
 			image:           "busybox:" + imgID,
113
-			expectedErrType: errdefs.IsNotFound,
113
+			expectedErrType: cerrdefs.IsNotFound,
114 114
 			expectedErr:     "Error response from daemon: No such image: busybox:" + imgID,
115 115
 		},
116 116
 	}
... ...
@@ -160,7 +160,7 @@ func TestCreateLinkToNonExistingContainer(t *testing.T) {
160 160
 		"",
161 161
 	)
162 162
 	assert.Check(t, is.ErrorContains(err, "could not get container for no-such-container"))
163
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
163
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
164 164
 }
165 165
 
166 166
 func TestCreateWithInvalidEnv(t *testing.T) {
... ...
@@ -200,7 +200,7 @@ func TestCreateWithInvalidEnv(t *testing.T) {
200 200
 				"",
201 201
 			)
202 202
 			assert.Check(t, is.ErrorContains(err, tc.expectedError))
203
-			assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
203
+			assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
204 204
 		})
205 205
 	}
206 206
 }
... ...
@@ -247,7 +247,7 @@ func TestCreateTmpfsMountsTarget(t *testing.T) {
247 247
 			"",
248 248
 		)
249 249
 		assert.Check(t, is.ErrorContains(err, tc.expectedError))
250
-		assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
250
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
251 251
 	}
252 252
 }
253 253
 
... ...
@@ -502,7 +502,7 @@ func TestCreateWithInvalidHealthcheckParams(t *testing.T) {
502 502
 
503 503
 			resp, err := apiClient.ContainerCreate(ctx, &cfg, &container.HostConfig{}, nil, nil, "")
504 504
 			assert.Check(t, is.Equal(len(resp.Warnings), 0))
505
-			assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
505
+			assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
506 506
 			assert.ErrorContains(t, err, tc.expectedErr)
507 507
 		})
508 508
 	}
... ...
@@ -572,7 +572,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
572 572
 			Variant:      img.Variant,
573 573
 		}
574 574
 		_, err := apiClient.ContainerCreate(ctx, &container.Config{Image: "busybox:latest"}, &container.HostConfig{}, nil, &p, "")
575
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
575
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
576 576
 	})
577 577
 	t.Run("different cpu arch", func(t *testing.T) {
578 578
 		ctx := testutil.StartSpan(ctx, t)
... ...
@@ -582,7 +582,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
582 582
 			Variant:      img.Variant,
583 583
 		}
584 584
 		_, err := apiClient.ContainerCreate(ctx, &container.Config{Image: "busybox:latest"}, &container.HostConfig{}, nil, &p, "")
585
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
585
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
586 586
 	})
587 587
 }
588 588
 
... ...
@@ -598,7 +598,7 @@ func TestCreateVolumesFromNonExistingContainer(t *testing.T) {
598 598
 		nil,
599 599
 		"",
600 600
 	)
601
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
601
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
602 602
 }
603 603
 
604 604
 // Test that we can create a container from an image that is for a different platform even if a platform was not specified
... ...
@@ -673,7 +673,7 @@ func TestCreateInvalidHostConfig(t *testing.T) {
673 673
 			}
674 674
 			resp, err := apiClient.ContainerCreate(ctx, &cfg, &tc.hc, nil, nil, "")
675 675
 			assert.Check(t, is.Equal(len(resp.Warnings), 0))
676
-			assert.Check(t, errdefs.IsInvalidParameter(err), "got: %T", err)
676
+			assert.Check(t, cerrdefs.IsInvalidArgument(err), "got: %T", err)
677 677
 			assert.Error(t, err, tc.expectedErr)
678 678
 		})
679 679
 	}
... ...
@@ -10,9 +10,9 @@ import (
10 10
 	"testing"
11 11
 	"time"
12 12
 
13
+	cerrdefs "github.com/containerd/errdefs"
13 14
 	"github.com/docker/docker/api/types"
14 15
 	containertypes "github.com/docker/docker/api/types/container"
15
-	"github.com/docker/docker/errdefs"
16 16
 	"github.com/docker/docker/integration/internal/build"
17 17
 	"github.com/docker/docker/integration/internal/container"
18 18
 	"github.com/docker/docker/testutil/fakecontext"
... ...
@@ -244,7 +244,7 @@ func TestExecResize(t *testing.T) {
244 244
 			Height: 40,
245 245
 			Width:  40,
246 246
 		})
247
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
247
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
248 248
 		assert.Check(t, is.ErrorContains(err, "No such exec instance: no-such-exec-id"))
249 249
 	})
250 250
 
... ...
@@ -272,7 +272,7 @@ func TestExecResize(t *testing.T) {
272 272
 			Height: 40,
273 273
 			Width:  40,
274 274
 		})
275
-		assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
275
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
276 276
 		assert.Check(t, is.ErrorContains(err, "is not running"))
277 277
 	})
278 278
 }
... ...
@@ -394,7 +394,7 @@ func TestExecUser(t *testing.T) {
394 394
 			result, err := container.Exec(ctx, apiClient, cID, []string{"id"}, withUser(tc.user))
395 395
 			if tc.expectedErr != "" {
396 396
 				assert.Check(t, is.Error(err, tc.expectedErr))
397
-				assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
397
+				assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
398 398
 				assert.Check(t, is.Equal(result.Stdout(), "<nil>"))
399 399
 				assert.Check(t, is.Equal(result.Stderr(), "<nil>"))
400 400
 			} else {
... ...
@@ -7,13 +7,13 @@ import (
7 7
 	"syscall"
8 8
 	"testing"
9 9
 
10
+	cerrdefs "github.com/containerd/errdefs"
10 11
 	"github.com/docker/docker/api"
11 12
 	containertypes "github.com/docker/docker/api/types/container"
12 13
 	mounttypes "github.com/docker/docker/api/types/mount"
13 14
 	"github.com/docker/docker/api/types/network"
14 15
 	"github.com/docker/docker/api/types/versions"
15 16
 	"github.com/docker/docker/client"
16
-	"github.com/docker/docker/errdefs"
17 17
 	"github.com/docker/docker/integration/internal/container"
18 18
 	"github.com/docker/docker/pkg/parsers/kernel"
19 19
 	"github.com/docker/docker/testutil"
... ...
@@ -435,7 +435,7 @@ func TestContainerVolumeAnonymous(t *testing.T) {
435 435
 		// when used, which we use as indicator that the driver was passed
436 436
 		// through. We should have a cleaner way for this, but that would
437 437
 		// require a custom volume plugin to be installed.
438
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
438
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
439 439
 		assert.Check(t, is.ErrorContains(err, fmt.Sprintf(`plugin %q not found`, testNonExistingPlugin)))
440 440
 	})
441 441
 }
... ...
@@ -4,8 +4,8 @@ import (
4 4
 	"os"
5 5
 	"testing"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	containertypes "github.com/docker/docker/api/types/container"
8
-	"github.com/docker/docker/errdefs"
9 9
 	"github.com/docker/docker/integration/internal/container"
10 10
 	"gotest.tools/v3/assert"
11 11
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -39,7 +39,7 @@ func TestPIDModeContainer(t *testing.T) {
39 39
 
40 40
 	t.Run("non-existing container", func(t *testing.T) {
41 41
 		_, err := container.CreateFromConfig(ctx, apiClient, container.NewTestConfig(container.WithPIDMode("container:nosuchcontainer")))
42
-		assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
42
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
43 43
 		assert.Check(t, is.ErrorContains(err, "No such container: nosuchcontainer"))
44 44
 	})
45 45
 
... ...
@@ -51,7 +51,7 @@ func TestPIDModeContainer(t *testing.T) {
51 51
 		assert.NilError(t, err, "should not produce an error when creating, only when starting")
52 52
 
53 53
 		err = apiClient.ContainerStart(ctx, ctr.ID, containertypes.StartOptions{})
54
-		assert.Check(t, is.ErrorType(err, errdefs.IsSystem), "should produce a System error when starting an existing container from an invalid state")
54
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal), "should produce a System error when starting an existing container from an invalid state")
55 55
 		assert.Check(t, is.ErrorContains(err, "failed to join PID namespace"))
56 56
 		assert.Check(t, is.ErrorContains(err, cPIDContainerID+" is not running"))
57 57
 	})
... ...
@@ -4,10 +4,10 @@ import (
4 4
 	"os"
5 5
 	"testing"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	containertypes "github.com/docker/docker/api/types/container"
8 9
 	"github.com/docker/docker/api/types/filters"
9 10
 	"github.com/docker/docker/api/types/volume"
10
-	"github.com/docker/docker/errdefs"
11 11
 	"github.com/docker/docker/integration/internal/container"
12 12
 	"gotest.tools/v3/assert"
13 13
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -46,7 +46,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
46 46
 	assert.NilError(t, err)
47 47
 
48 48
 	_, _, err = apiClient.ContainerInspectWithRaw(ctx, cID, true)
49
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
49
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
50 50
 	assert.Check(t, is.ErrorContains(err, "No such container"))
51 51
 }
52 52
 
... ...
@@ -84,7 +84,7 @@ func TestRemoveContainerRunning(t *testing.T) {
84 84
 	cID := container.Run(ctx, t, apiClient)
85 85
 
86 86
 	err := apiClient.ContainerRemove(ctx, cID, containertypes.RemoveOptions{})
87
-	assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
87
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
88 88
 	assert.Check(t, is.ErrorContains(err, "container is running"))
89 89
 }
90 90
 
... ...
@@ -105,6 +105,6 @@ func TestRemoveInvalidContainer(t *testing.T) {
105 105
 	apiClient := testEnv.APIClient()
106 106
 
107 107
 	err := apiClient.ContainerRemove(ctx, "unknown", containertypes.RemoveOptions{})
108
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
108
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
109 109
 	assert.Check(t, is.ErrorContains(err, "No such container"))
110 110
 }
... ...
@@ -6,9 +6,9 @@ import (
6 6
 	"net/url"
7 7
 	"testing"
8 8
 
9
+	cerrdefs "github.com/containerd/errdefs"
9 10
 	"github.com/docker/docker/api/types"
10 11
 	containertypes "github.com/docker/docker/api/types/container"
11
-	"github.com/docker/docker/errdefs"
12 12
 	"github.com/docker/docker/integration/internal/container"
13 13
 	req "github.com/docker/docker/testutil/request"
14 14
 	"gotest.tools/v3/assert"
... ...
@@ -133,7 +133,7 @@ func TestResize(t *testing.T) {
133 133
 			Height: 40,
134 134
 			Width:  40,
135 135
 		})
136
-		assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
136
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
137 137
 		assert.Check(t, is.ErrorContains(err, "is not running"))
138 138
 	})
139 139
 }
... ...
@@ -8,9 +8,9 @@ import (
8 8
 	"testing"
9 9
 	"time"
10 10
 
11
+	cerrdefs "github.com/containerd/errdefs"
11 12
 	containertypes "github.com/docker/docker/api/types/container"
12 13
 	"github.com/docker/docker/client"
13
-	"github.com/docker/docker/errdefs"
14 14
 	"github.com/docker/docker/integration/internal/container"
15 15
 	"github.com/docker/docker/pkg/stdcopy"
16 16
 	"gotest.tools/v3/assert"
... ...
@@ -50,7 +50,7 @@ func TestStopContainerWithTimeoutCancel(t *testing.T) {
50 50
 
51 51
 	select {
52 52
 	case stoppedErr := <-stoppedCh:
53
-		assert.Check(t, is.ErrorType(stoppedErr, errdefs.IsCancelled))
53
+		assert.Check(t, is.ErrorType(stoppedErr, cerrdefs.IsCanceled))
54 54
 	case <-time.After(5 * time.Second):
55 55
 		t.Fatal("timeout waiting for stop request to be cancelled")
56 56
 	}
... ...
@@ -4,8 +4,8 @@ import (
4 4
 	"testing"
5 5
 	"time"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	containertypes "github.com/docker/docker/api/types/container"
8
-	"github.com/docker/docker/errdefs"
9 9
 	"github.com/docker/docker/integration/internal/container"
10 10
 	"gotest.tools/v3/assert"
11 11
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -56,5 +56,5 @@ func TestUpdateRestartWithAutoRemove(t *testing.T) {
56 56
 		},
57 57
 	})
58 58
 	assert.Check(t, is.ErrorContains(err, "Restart policy cannot be updated because AutoRemove is enabled for the container"))
59
-	assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
59
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
60 60
 }
... ...
@@ -14,12 +14,12 @@ import (
14 14
 	"syscall"
15 15
 	"testing"
16 16
 
17
+	cerrdefs "github.com/containerd/errdefs"
17 18
 	containertypes "github.com/docker/docker/api/types/container"
18 19
 	"github.com/docker/docker/api/types/image"
19 20
 	"github.com/docker/docker/api/types/mount"
20 21
 	"github.com/docker/docker/api/types/volume"
21 22
 	"github.com/docker/docker/daemon/config"
22
-	"github.com/docker/docker/errdefs"
23 23
 	"github.com/docker/docker/integration/internal/container"
24 24
 	"github.com/docker/docker/integration/internal/process"
25 25
 	"github.com/docker/docker/pkg/stdcopy"
... ...
@@ -609,7 +609,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
609 609
 		poll.WaitOn(t, func(t poll.LogT) poll.Result {
610 610
 			stat, err := c.ContainerStatPath(ctx, cID, "/foo/test.txt")
611 611
 			if err != nil {
612
-				if errdefs.IsNotFound(err) {
612
+				if cerrdefs.IsNotFound(err) {
613 613
 					return poll.Continue("file doesn't yet exist")
614 614
 				}
615 615
 				return poll.Error(err)
... ...
@@ -682,7 +682,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
682 682
 		waitFn := func(t poll.LogT) poll.Result {
683 683
 			_, err := c.ContainerStatPath(ctx, cID, "/image/hello")
684 684
 			if err != nil {
685
-				if errdefs.IsNotFound(err) {
685
+				if cerrdefs.IsNotFound(err) {
686 686
 					return poll.Continue("file doesn't yet exist")
687 687
 				}
688 688
 				return poll.Error(err)
... ...
@@ -9,8 +9,8 @@ import (
9 9
 	"strings"
10 10
 	"testing"
11 11
 
12
+	cerrdefs "github.com/containerd/errdefs"
12 13
 	imagetypes "github.com/docker/docker/api/types/image"
13
-	"github.com/docker/docker/errdefs"
14 14
 	"github.com/docker/docker/image"
15 15
 	"github.com/docker/docker/testutil"
16 16
 	"github.com/docker/docker/testutil/daemon"
... ...
@@ -178,7 +178,7 @@ func TestImportWithCustomPlatformReject(t *testing.T) {
178 178
 				reference,
179 179
 				imagetypes.ImportOptions{Platform: tc.platform})
180 180
 
181
-			assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
181
+			assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
182 182
 			assert.Check(t, is.ErrorContains(err, tc.expectedErr))
183 183
 		})
184 184
 	}
... ...
@@ -15,9 +15,9 @@ import (
15 15
 	"github.com/containerd/containerd/v2/core/content"
16 16
 	c8dimages "github.com/containerd/containerd/v2/core/images"
17 17
 	"github.com/containerd/containerd/v2/plugins/content/local"
18
+	cerrdefs "github.com/containerd/errdefs"
18 19
 	"github.com/containerd/platforms"
19 20
 	"github.com/docker/docker/api/types/image"
20
-	"github.com/docker/docker/errdefs"
21 21
 	"github.com/docker/docker/testutil/daemon"
22 22
 	"github.com/docker/docker/testutil/registry"
23 23
 	"github.com/opencontainers/go-digest"
... ...
@@ -36,7 +36,7 @@ func TestImagePullPlatformInvalid(t *testing.T) {
36 36
 	_, err := client.ImagePull(ctx, "docker.io/library/hello-world:latest", image.PullOptions{Platform: "foobar"})
37 37
 	assert.Assert(t, err != nil)
38 38
 	assert.Check(t, is.ErrorContains(err, "unknown operating system or architecture"))
39
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
39
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
40 40
 }
41 41
 
42 42
 func createTestImage(ctx context.Context, t testing.TB, store content.Store) ocispec.Descriptor {
... ...
@@ -157,8 +157,8 @@ func TestImagePullStoredDigestForOtherRepo(t *testing.T) {
157 157
 		assert.Check(t, rdr.Close())
158 158
 	}
159 159
 	assert.Assert(t, err != nil, "Expected error, got none: %v", err)
160
-	assert.Assert(t, errdefs.IsNotFound(err), err)
161
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
160
+	assert.Assert(t, cerrdefs.IsNotFound(err), err)
161
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
162 162
 }
163 163
 
164 164
 // TestImagePullNonExisting pulls non-existing images from the central registry, with different
... ...
@@ -188,7 +188,7 @@ func TestImagePullNonExisting(t *testing.T) {
188 188
 
189 189
 			expectedMsg := fmt.Sprintf("pull access denied for %s, repository does not exist or may require 'docker login'", "asdfasdf")
190 190
 			assert.Check(t, is.ErrorContains(err, expectedMsg))
191
-			assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
191
+			assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
192 192
 			if all {
193 193
 				// pull -a on a nonexistent registry should fall back as well
194 194
 				assert.Check(t, !strings.Contains(err.Error(), "unauthorized"), `message should not contain "unauthorized"`)
... ...
@@ -4,11 +4,11 @@ import (
4 4
 	"strings"
5 5
 	"testing"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	"github.com/containerd/platforms"
8 9
 
9 10
 	containertypes "github.com/docker/docker/api/types/container"
10 11
 	"github.com/docker/docker/api/types/image"
11
-	"github.com/docker/docker/errdefs"
12 12
 	"github.com/docker/docker/integration/internal/container"
13 13
 	"github.com/docker/docker/internal/testutils/specialimage"
14 14
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
... ...
@@ -92,7 +92,7 @@ func TestRemoveByDigest(t *testing.T) {
92 92
 	assert.NilError(t, err, "busybox image got deleted")
93 93
 
94 94
 	inspect, err = client.ImageInspect(ctx, "test-remove-by-digest")
95
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
95
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
96 96
 	assert.Check(t, is.DeepEqual(inspect, image.InspectResponse{}))
97 97
 }
98 98
 
... ...
@@ -13,11 +13,11 @@ import (
13 13
 	"testing"
14 14
 	"time"
15 15
 
16
+	cerrdefs "github.com/containerd/errdefs"
16 17
 	"github.com/cpuguy83/tar2go"
17 18
 	containertypes "github.com/docker/docker/api/types/container"
18 19
 	"github.com/docker/docker/api/types/versions"
19 20
 	"github.com/docker/docker/client"
20
-	"github.com/docker/docker/errdefs"
21 21
 	"github.com/docker/docker/integration/internal/build"
22 22
 	"github.com/docker/docker/integration/internal/container"
23 23
 	"github.com/docker/docker/internal/testutils"
... ...
@@ -227,7 +227,7 @@ func TestSavePlatform(t *testing.T) {
227 227
 		ocispec.Platform{Architecture: "amd64", OS: "linux"},
228 228
 		ocispec.Platform{Architecture: "arm64", OS: "linux", Variant: "v8"},
229 229
 	))
230
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
230
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
231 231
 	assert.Check(t, is.Error(err, "Error response from daemon: multiple platform parameters not supported"))
232 232
 }
233 233
 
... ...
@@ -4,9 +4,9 @@ import (
4 4
 	"context"
5 5
 	"strings"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	"github.com/docker/docker/api/types/container"
8 9
 	"github.com/docker/docker/client"
9
-	"github.com/docker/docker/errdefs"
10 10
 	"github.com/pkg/errors"
11 11
 	"gotest.tools/v3/poll"
12 12
 )
... ...
@@ -74,7 +74,7 @@ func IsRemoved(ctx context.Context, apiClient client.APIClient, containerID stri
74 74
 	return func(log poll.LogT) poll.Result {
75 75
 		inspect, err := apiClient.ContainerInspect(ctx, containerID)
76 76
 		if err != nil {
77
-			if errdefs.IsNotFound(err) {
77
+			if cerrdefs.IsNotFound(err) {
78 78
 				return poll.Success()
79 79
 			}
80 80
 			return poll.Error(err)
... ...
@@ -8,11 +8,11 @@ import (
8 8
 	"testing"
9 9
 	"time"
10 10
 
11
+	cerrdefs "github.com/containerd/errdefs"
11 12
 	"github.com/docker/docker/api/types/container"
12 13
 	"github.com/docker/docker/api/types/filters"
13 14
 	swarmtypes "github.com/docker/docker/api/types/swarm"
14 15
 	"github.com/docker/docker/client"
15
-	"github.com/docker/docker/errdefs"
16 16
 	"github.com/docker/docker/integration/internal/swarm"
17 17
 	"github.com/docker/docker/pkg/stdcopy"
18 18
 	"github.com/docker/docker/testutil"
... ...
@@ -142,18 +142,18 @@ func TestSecretsCreateAndDelete(t *testing.T) {
142 142
 		},
143 143
 		Data: []byte("TESTINGDATA"),
144 144
 	})
145
-	assert.Check(t, errdefs.IsConflict(err))
145
+	assert.Check(t, cerrdefs.IsConflict(err))
146 146
 	assert.Check(t, is.ErrorContains(err, testName))
147 147
 
148 148
 	err = c.SecretRemove(ctx, secretID)
149 149
 	assert.NilError(t, err)
150 150
 
151 151
 	_, _, err = c.SecretInspectWithRaw(ctx, secretID)
152
-	assert.Check(t, errdefs.IsNotFound(err))
152
+	assert.Check(t, cerrdefs.IsNotFound(err))
153 153
 	assert.Check(t, is.ErrorContains(err, secretID))
154 154
 
155 155
 	err = c.SecretRemove(ctx, "non-existing")
156
-	assert.Check(t, errdefs.IsNotFound(err))
156
+	assert.Check(t, cerrdefs.IsNotFound(err))
157 157
 	assert.Check(t, is.ErrorContains(err, "non-existing"))
158 158
 
159 159
 	testName = "test_secret_with_labels_" + t.Name()
... ...
@@ -217,7 +217,7 @@ func TestSecretsUpdate(t *testing.T) {
217 217
 	// this test will produce an error in func UpdateSecret
218 218
 	insp.Spec.Data = []byte("TESTINGDATA2")
219 219
 	err = c.SecretUpdate(ctx, secretID, insp.Version, insp.Spec)
220
-	assert.Check(t, errdefs.IsInvalidParameter(err))
220
+	assert.Check(t, cerrdefs.IsInvalidArgument(err))
221 221
 	assert.Check(t, is.ErrorContains(err, "only updates to Labels are allowed"))
222 222
 }
223 223
 
... ...
@@ -7,11 +7,11 @@ import (
7 7
 	"testing"
8 8
 	"time"
9 9
 
10
+	cerrdefs "github.com/containerd/errdefs"
10 11
 	"github.com/docker/docker/api/types/container"
11 12
 	"github.com/docker/docker/api/types/filters"
12 13
 	swarmtypes "github.com/docker/docker/api/types/swarm"
13 14
 	"github.com/docker/docker/client"
14
-	"github.com/docker/docker/errdefs"
15 15
 	"github.com/docker/docker/integration/internal/network"
16 16
 	"github.com/docker/docker/integration/internal/swarm"
17 17
 	"github.com/docker/docker/testutil"
... ...
@@ -165,7 +165,7 @@ func TestCreateServiceConflict(t *testing.T) {
165 165
 
166 166
 	spec := swarm.CreateServiceSpec(t, serviceSpec...)
167 167
 	_, err := c.ServiceCreate(ctx, spec, swarmtypes.ServiceCreateOptions{})
168
-	assert.Check(t, errdefs.IsConflict(err))
168
+	assert.Check(t, cerrdefs.IsConflict(err))
169 169
 	assert.ErrorContains(t, err, "service "+serviceName+" already exists")
170 170
 }
171 171
 
... ...
@@ -8,11 +8,11 @@ import (
8 8
 	"testing"
9 9
 	"time"
10 10
 
11
+	cerrdefs "github.com/containerd/errdefs"
11 12
 	containertypes "github.com/docker/docker/api/types/container"
12 13
 	"github.com/docker/docker/api/types/filters"
13 14
 	"github.com/docker/docker/api/types/volume"
14 15
 	clientpkg "github.com/docker/docker/client"
15
-	"github.com/docker/docker/errdefs"
16 16
 	"github.com/docker/docker/integration/internal/build"
17 17
 	"github.com/docker/docker/integration/internal/container"
18 18
 	"github.com/docker/docker/testutil"
... ...
@@ -79,7 +79,7 @@ func TestVolumesRemove(t *testing.T) {
79 79
 
80 80
 	t.Run("volume in use", func(t *testing.T) {
81 81
 		err = client.VolumeRemove(ctx, vname, false)
82
-		assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
82
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
83 83
 		assert.Check(t, is.ErrorContains(err, "volume is in use"))
84 84
 	})
85 85
 
... ...
@@ -95,7 +95,7 @@ func TestVolumesRemove(t *testing.T) {
95 95
 
96 96
 	t.Run("non-existing volume", func(t *testing.T) {
97 97
 		err = client.VolumeRemove(ctx, "no_such_volume", false)
98
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
98
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
99 99
 	})
100 100
 
101 101
 	t.Run("non-existing volume force", func(t *testing.T) {
... ...
@@ -131,7 +131,7 @@ func TestVolumesRemoveSwarmEnabled(t *testing.T) {
131 131
 
132 132
 	t.Run("volume in use", func(t *testing.T) {
133 133
 		err = client.VolumeRemove(ctx, vname, false)
134
-		assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
134
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
135 135
 		assert.Check(t, is.ErrorContains(err, "volume is in use"))
136 136
 	})
137 137
 
... ...
@@ -147,7 +147,7 @@ func TestVolumesRemoveSwarmEnabled(t *testing.T) {
147 147
 
148 148
 	t.Run("non-existing volume", func(t *testing.T) {
149 149
 		err = client.VolumeRemove(ctx, "no_such_volume", false)
150
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
150
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
151 151
 	})
152 152
 
153 153
 	t.Run("non-existing volume force", func(t *testing.T) {
... ...
@@ -4,11 +4,11 @@ import (
4 4
 	"context"
5 5
 
6 6
 	containerd "github.com/containerd/containerd/v2/client"
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	"github.com/containerd/log"
8 9
 	"github.com/opencontainers/runtime-spec/specs-go"
9 10
 	"github.com/pkg/errors"
10 11
 
11
-	"github.com/docker/docker/errdefs"
12 12
 	"github.com/docker/docker/libcontainerd/types"
13 13
 )
14 14
 
... ...
@@ -19,14 +19,14 @@ func ReplaceContainer(ctx context.Context, client types.Client, id string, spec
19 19
 		return client.NewContainer(ctx, id, spec, shim, runtimeOptions, opts...)
20 20
 	}
21 21
 	ctr, err := newContainer()
22
-	if err == nil || !errdefs.IsConflict(err) {
22
+	if err == nil || !cerrdefs.IsConflict(err) {
23 23
 		return ctr, err
24 24
 	}
25 25
 
26 26
 	log.G(ctx).WithContext(ctx).WithField("container", id).Debug("A container already exists with the same ID. Attempting to clean up the old container.")
27 27
 	ctr, err = client.LoadContainer(ctx, id)
28 28
 	if err != nil {
29
-		if errdefs.IsNotFound(err) {
29
+		if cerrdefs.IsNotFound(err) {
30 30
 			// Task failed successfully: the container no longer exists,
31 31
 			// despite us not doing anything. May as well try to create
32 32
 			// the container again. It might succeed.
... ...
@@ -36,7 +36,7 @@ func ReplaceContainer(ctx context.Context, client types.Client, id string, spec
36 36
 	}
37 37
 	tsk, err := ctr.Task(ctx)
38 38
 	if err != nil {
39
-		if errdefs.IsNotFound(err) {
39
+		if cerrdefs.IsNotFound(err) {
40 40
 			goto deleteContainer
41 41
 		}
42 42
 		// There is no point in trying to delete the container if we
... ...
@@ -46,14 +46,14 @@ func ReplaceContainer(ctx context.Context, client types.Client, id string, spec
46 46
 		return nil, errors.Wrap(err, "could not load stale containerd task object")
47 47
 	}
48 48
 	if err := tsk.ForceDelete(ctx); err != nil {
49
-		if !errdefs.IsNotFound(err) {
49
+		if !cerrdefs.IsNotFound(err) {
50 50
 			return nil, errors.Wrap(err, "could not delete stale containerd task object")
51 51
 		}
52 52
 		// The task might have exited on its own. Proceed with
53 53
 		// attempting to delete the container.
54 54
 	}
55 55
 deleteContainer:
56
-	if err := ctr.Delete(ctx); err != nil && !errdefs.IsNotFound(err) {
56
+	if err := ctr.Delete(ctx); err != nil && !cerrdefs.IsNotFound(err) {
57 57
 		return nil, errors.Wrap(err, "could not delete stale containerd container object")
58 58
 	}
59 59
 
... ...
@@ -5,8 +5,8 @@ import (
5 5
 	"fmt"
6 6
 	"strings"
7 7
 
8
+	cerrdefs "github.com/containerd/errdefs"
8 9
 	"github.com/containerd/log"
9
-	"github.com/docker/docker/errdefs"
10 10
 	"github.com/docker/docker/libnetwork/netlabel"
11 11
 	"github.com/docker/docker/libnetwork/types"
12 12
 )
... ...
@@ -170,7 +170,7 @@ func (c *Controller) defaultGwNetwork() (*Network, error) {
170 170
 	defer func() { <-procGwNetwork }()
171 171
 
172 172
 	n, err := c.NetworkByName(libnGWNetwork)
173
-	if errdefs.IsNotFound(err) {
173
+	if cerrdefs.IsNotFound(err) {
174 174
 		n, err = c.createGWNetwork()
175 175
 	}
176 176
 	return n, err
... ...
@@ -8,8 +8,8 @@ import (
8 8
 	"fmt"
9 9
 	"net/netip"
10 10
 
11
+	cerrdefs "github.com/containerd/errdefs"
11 12
 	"github.com/containerd/log"
12
-	"github.com/docker/docker/errdefs"
13 13
 	"github.com/docker/docker/libnetwork/drivers/bridge/internal/firewaller"
14 14
 	"github.com/docker/docker/libnetwork/iptables"
15 15
 )
... ...
@@ -106,7 +106,7 @@ func (n *network) setupIPTables(ctx context.Context, ipVersion iptables.IPVersio
106 106
 			return err
107 107
 		}
108 108
 		n.registerCleanFunc(func() error {
109
-			if err := iptables.DelInterfaceFirewalld(n.config.IfName); err != nil && !errdefs.IsNotFound(err) {
109
+			if err := iptables.DelInterfaceFirewalld(n.config.IfName); err != nil && !cerrdefs.IsNotFound(err) {
110 110
 				return err
111 111
 			}
112 112
 			return nil
... ...
@@ -534,7 +534,7 @@ func setupInternalNetworkRules(ctx context.Context, bridgeIface string, prefix n
534 534
 			return err
535 535
 		}
536 536
 	} else {
537
-		if err := iptables.DelInterfaceFirewalld(bridgeIface); err != nil && !errdefs.IsNotFound(err) {
537
+		if err := iptables.DelInterfaceFirewalld(bridgeIface); err != nil && !cerrdefs.IsNotFound(err) {
538 538
 			return err
539 539
 		}
540 540
 	}
... ...
@@ -4,7 +4,7 @@ import (
4 4
 	"context"
5 5
 	"testing"
6 6
 
7
-	"github.com/docker/docker/errdefs"
7
+	cerrdefs "github.com/containerd/errdefs"
8 8
 	"github.com/docker/docker/internal/nlwrap"
9 9
 	"github.com/docker/docker/internal/testutils/netnsutils"
10 10
 	"github.com/docker/docker/internal/testutils/storeutils"
... ...
@@ -36,7 +36,7 @@ func TestLinkCreate(t *testing.T) {
36 36
 
37 37
 	te := newTestEndpoint46(ipdList[0].Pool, ipd6List[0].Pool, 10)
38 38
 	err = d.CreateEndpoint(context.Background(), "dummy", "", te.Interface(), nil)
39
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
39
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
40 40
 	assert.Check(t, is.Error(err, "invalid endpoint id: "))
41 41
 
42 42
 	// Good endpoint creation
... ...
@@ -57,7 +57,7 @@ func TestLinkCreate(t *testing.T) {
57 57
 
58 58
 	te1 := newTestEndpoint(ipdList[0].Pool, 11)
59 59
 	err = d.CreateEndpoint(context.Background(), "dummy", "ep", te1.Interface(), nil)
60
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
60
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
61 61
 	assert.Assert(t, is.Error(err, "Endpoint (ep) already exists (Only one endpoint allowed)"), "Failed to detect duplicate endpoint id on same network")
62 62
 
63 63
 	_, err = nlwrap.LinkByName(te.iface.srcName)
... ...
@@ -100,7 +100,7 @@ func TestLinkCreateTwo(t *testing.T) {
100 100
 
101 101
 	te2 := newTestEndpoint(ipdList[0].Pool, 12)
102 102
 	err = d.CreateEndpoint(context.Background(), "dummy", "ep", te2.Interface(), nil)
103
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
103
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
104 104
 	assert.Assert(t, is.Error(err, "Endpoint (ep) already exists (Only one endpoint allowed)"), "Failed to detect duplicate endpoint id on same network")
105 105
 }
106 106
 
... ...
@@ -152,7 +152,7 @@ func TestLinkDelete(t *testing.T) {
152 152
 	assert.NilError(t, err)
153 153
 
154 154
 	err = d.DeleteEndpoint("dummy", "")
155
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
155
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
156 156
 	assert.Assert(t, is.Error(err, "invalid endpoint id: "))
157 157
 
158 158
 	err = d.DeleteEndpoint("dummy", "ep1")
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"syscall"
7 7
 	"testing"
8 8
 
9
-	"github.com/docker/docker/errdefs"
9
+	cerrdefs "github.com/containerd/errdefs"
10 10
 	"github.com/docker/docker/internal/nlwrap"
11 11
 	"github.com/docker/docker/internal/testutils/netnsutils"
12 12
 	"github.com/docker/docker/libnetwork/netutils"
... ...
@@ -52,7 +52,7 @@ func TestSetupNewNonDefaultBridge(t *testing.T) {
52 52
 
53 53
 	err = setupDevice(config, br)
54 54
 	assert.Check(t, is.Error(err, "bridge device with non default name test0 must be created manually"))
55
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
55
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
56 56
 }
57 57
 
58 58
 func TestSetupDeviceUp(t *testing.T) {
... ...
@@ -3,7 +3,7 @@ package libnetwork
3 3
 import (
4 4
 	"testing"
5 5
 
6
-	"github.com/docker/docker/errdefs"
6
+	cerrdefs "github.com/containerd/errdefs"
7 7
 	"github.com/docker/docker/libnetwork/types"
8 8
 	"gotest.tools/v3/assert"
9 9
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -21,11 +21,11 @@ func TestErrorInterfaces(t *testing.T) {
21 21
 
22 22
 	notFoundErrorList := []error{ErrNoSuchNetwork("")}
23 23
 	for _, err := range notFoundErrorList {
24
-		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
24
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
25 25
 	}
26 26
 
27 27
 	forbiddenErrorList := []error{&ActiveContainerError{}}
28 28
 	for _, err := range forbiddenErrorList {
29
-		assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
29
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
30 30
 	}
31 31
 }
... ...
@@ -15,8 +15,8 @@ import (
15 15
 	"sync"
16 16
 	"testing"
17 17
 
18
+	cerrdefs "github.com/containerd/errdefs"
18 19
 	"github.com/containerd/log"
19
-	"github.com/docker/docker/errdefs"
20 20
 	"github.com/docker/docker/internal/nlwrap"
21 21
 	"github.com/docker/docker/internal/testutils/netnsutils"
22 22
 	"github.com/docker/docker/libnetwork"
... ...
@@ -112,7 +112,7 @@ func TestNull(t *testing.T) {
112 112
 	err = network.Delete()
113 113
 
114 114
 	// TODO(thaJeztah): should this be an [errdefs.ErrInvalidParameter] ?
115
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
115
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
116 116
 	assert.Check(t, is.Error(err, `network of type "null" cannot be deleted`))
117 117
 }
118 118
 
... ...
@@ -123,7 +123,7 @@ func TestUnknownDriver(t *testing.T) {
123 123
 	_, err := createTestNetwork(controller, "unknowndriver", "testnetwork", options.Generic{}, nil, nil)
124 124
 
125 125
 	// TODO(thaJeztah): should attempting to use a non-existing plugin/driver return an [errdefs.ErrInvalidParameter] ?
126
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
126
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
127 127
 	assert.Check(t, is.Error(err, "could not find plugin unknowndriver in v1 plugin registry: plugin not found"))
128 128
 }
129 129
 
... ...
@@ -135,7 +135,7 @@ func TestNilRemoteDriver(t *testing.T) {
135 135
 		libnetwork.NetworkOptionGeneric(getEmptyGenericOption()))
136 136
 
137 137
 	// TODO(thaJeztah): should attempting to use a non-existing plugin/driver return an [errdefs.InvalidParameter] ?
138
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
138
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
139 139
 	assert.Check(t, is.Error(err, "could not find plugin framerelay in v1 plugin registry: plugin not found"))
140 140
 }
141 141
 
... ...
@@ -151,7 +151,7 @@ func TestNetworkName(t *testing.T) {
151 151
 	}
152 152
 
153 153
 	_, err := createTestNetwork(controller, bridgeNetType, "", netOption, nil, nil)
154
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter), "Expected to fail with ErrInvalidName error")
154
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument), "Expected to fail with ErrInvalidName error")
155 155
 
156 156
 	const networkName = "testnetwork"
157 157
 	n, err := createTestNetwork(controller, bridgeNetType, networkName, netOption, nil, nil)
... ...
@@ -225,7 +225,7 @@ func TestDeleteNetworkWithActiveEndpoints(t *testing.T) {
225 225
 	assert.Check(t, errors.As(err, &activeEndpointsError))
226 226
 	assert.Check(t, is.ErrorContains(err, "has active endpoints"))
227 227
 	// TODO(thaJeztah): should this be [errdefs.ErrConflict] or [errdefs.ErrInvalidParameter]?
228
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
228
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
229 229
 
230 230
 	// Done testing. Now cleanup.
231 231
 	err = ep.Delete(context.Background(), false)
... ...
@@ -246,7 +246,7 @@ func TestNetworkConfig(t *testing.T) {
246 246
 	)
247 247
 
248 248
 	// TODO(thaJeztah): should this be [errdefs.ErrInvalidParameter]?
249
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
249
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
250 250
 	assert.Check(t, is.Error(err, "a configuration network cannot depend on another configuration network"))
251 251
 
252 252
 	// Create supported config network
... ...
@@ -280,7 +280,7 @@ func TestNetworkConfig(t *testing.T) {
280 280
 				libnetwork.NetworkOptionConfigOnly(), opt)
281 281
 
282 282
 			// TODO(thaJeztah): should this be [errdefs.ErrInvalidParameter]?
283
-			assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
283
+			assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
284 284
 			assert.Check(t, is.Error(err, "configuration network can only contain network specific fields. Network operator fields like [ ingress | internal | attachable | scope ] are not supported."))
285 285
 		})
286 286
 	}
... ...
@@ -300,7 +300,7 @@ func TestNetworkConfig(t *testing.T) {
300 300
 				libnetwork.NetworkOptionConfigFrom("config_network0"), opt)
301 301
 
302 302
 			// TODO(thaJeztah): should this be [errdefs.ErrInvalidParameter]?
303
-			assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
303
+			assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
304 304
 
305 305
 			//nolint:dupword // ignore "Duplicate words (network) found (dupword)"
306 306
 			// Doing a partial match here omn the error-string here, as this produces either;
... ...
@@ -321,7 +321,7 @@ func TestNetworkConfig(t *testing.T) {
321 321
 	// Verify the config network cannot be removed
322 322
 	err = configNetwork.Delete()
323 323
 	// TODO(thaJeztah): should this be [errdefs.ErrConflict] or [errdefs.ErrInvalidParameter]?
324
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
324
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
325 325
 	assert.Check(t, is.Error(err, `configuration network "config_network0" is in use`))
326 326
 
327 327
 	// Delete network
... ...
@@ -351,7 +351,7 @@ func TestUnknownNetwork(t *testing.T) {
351 351
 	assert.NilError(t, err)
352 352
 
353 353
 	err = network.Delete()
354
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
354
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
355 355
 	assert.Check(t, is.ErrorContains(err, "unknown network testnetwork id"))
356 356
 }
357 357
 
... ...
@@ -371,7 +371,7 @@ func TestUnknownEndpoint(t *testing.T) {
371 371
 	assert.NilError(t, err)
372 372
 
373 373
 	_, err = network.CreateEndpoint(context.Background(), "")
374
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter), "Expected to fail with ErrInvalidName error")
374
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument), "Expected to fail with ErrInvalidName error")
375 375
 	assert.Check(t, is.ErrorContains(err, "invalid name:"))
376 376
 
377 377
 	ep, err := network.CreateEndpoint(context.Background(), "testep")
... ...
@@ -513,7 +513,7 @@ func TestDuplicateEndpoint(t *testing.T) {
513 513
 	}()
514 514
 
515 515
 	// TODO(thaJeztah): should this be [errdefs.ErrConflict] or [errdefs.ErrInvalidParameter]?
516
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
516
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
517 517
 	assert.Check(t, is.Error(err, "endpoint with name ep1 already exists in network testnetwork"))
518 518
 }
519 519
 
... ...
@@ -548,15 +548,15 @@ func TestControllerQuery(t *testing.T) {
548 548
 	}()
549 549
 
550 550
 	_, err = controller.NetworkByName("")
551
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
551
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
552 552
 	assert.Check(t, is.ErrorContains(err, "invalid name:"))
553 553
 
554 554
 	_, err = controller.NetworkByID("")
555
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
555
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
556 556
 	assert.Check(t, is.Error(err, "invalid id: id is empty"))
557 557
 
558 558
 	g, err := controller.NetworkByID("network1")
559
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
559
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
560 560
 	assert.Check(t, is.Error(err, "network network1 not found"))
561 561
 	assert.Check(t, is.Nil(g), "search network using name as ID should not yield a result")
562 562
 
... ...
@@ -613,11 +613,11 @@ func TestNetworkQuery(t *testing.T) {
613 613
 	assert.Check(t, is.Equal(e, ep11), "EndpointByName() returned the wrong endpoint")
614 614
 
615 615
 	_, err = net1.EndpointByName("")
616
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
616
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
617 617
 	assert.Check(t, is.ErrorContains(err, "invalid name:"))
618 618
 
619 619
 	e, err = net1.EndpointByName("IamNotAnEndpoint")
620
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
620
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
621 621
 	assert.Check(t, is.Error(err, "endpoint IamNotAnEndpoint not found"))
622 622
 	assert.Check(t, is.Nil(e), "EndpointByName() returned endpoint on error")
623 623
 }
... ...
@@ -677,7 +677,7 @@ func TestEndpointDeleteWithActiveContainer(t *testing.T) {
677 677
 	assert.Check(t, errors.As(err, &activeContainerError))
678 678
 	assert.Check(t, is.ErrorContains(err, "has active containers"))
679 679
 	// TODO(thaJeztah): should this be [errdefs.ErrConflict] or [errdefs.ErrInvalidParameter]?
680
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
680
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
681 681
 }
682 682
 
683 683
 func TestEndpointMultipleJoins(t *testing.T) {
... ...
@@ -725,7 +725,7 @@ func TestEndpointMultipleJoins(t *testing.T) {
725 725
 
726 726
 	err = ep.Join(context.Background(), sbx2)
727 727
 	// TODO(thaJeztah): should this be [errdefs.ErrConflict] or [errdefs.ErrInvalidParameter]?
728
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
728
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
729 729
 	assert.Check(t, is.Error(err, "another container is attached to the same network endpoint"))
730 730
 }
731 731
 
... ...
@@ -806,17 +806,17 @@ func TestContainerInvalidLeave(t *testing.T) {
806 806
 	}()
807 807
 
808 808
 	err = ep.Leave(context.Background(), cnt)
809
-	assert.Assert(t, is.ErrorType(err, errdefs.IsForbidden), "Expected to fail leave from an endpoint which has no active join")
809
+	assert.Assert(t, is.ErrorType(err, cerrdefs.IsPermissionDenied), "Expected to fail leave from an endpoint which has no active join")
810 810
 	assert.Check(t, is.Error(err, "cannot leave endpoint with no attached sandbox"))
811 811
 
812 812
 	err = ep.Leave(context.Background(), nil)
813
-	assert.Assert(t, is.ErrorType(err, errdefs.IsInvalidParameter), "Expected to fail leave with a nil Sandbox")
813
+	assert.Assert(t, is.ErrorType(err, cerrdefs.IsInvalidArgument), "Expected to fail leave with a nil Sandbox")
814 814
 	// FIXME(thaJeztah): this error includes the raw data of the sandbox (as `<nil>`), which is not very informative
815 815
 	assert.Check(t, is.Error(err, "invalid Sandbox passed to endpoint leave: <nil>"))
816 816
 
817 817
 	fsbx := &libnetwork.Sandbox{}
818 818
 	err = ep.Leave(context.Background(), fsbx)
819
-	assert.Assert(t, is.ErrorType(err, errdefs.IsInvalidParameter), "Expected to fail leave with invalid Sandbox")
819
+	assert.Assert(t, is.ErrorType(err, cerrdefs.IsInvalidArgument), "Expected to fail leave with invalid Sandbox")
820 820
 	//nolint:dupword // Ignore "Duplicate words (map[]) found (dupword)"
821 821
 	// FIXME(thaJeztah): this error includes the raw data of the sandbox, which is not very human-readable or informative;
822 822
 	//	invalid Sandbox passed to endpoint leave: &{  {{    []} {   [] [] []} map[] false false []} [] <nil> <nil> <nil> {{{} 0} {0 0}} [] map[] map[] <nil> 0 false false false false false []  {0 0} {0 0}}
... ...
@@ -934,7 +934,7 @@ func TestValidRemoteDriver(t *testing.T) {
934 934
 		libnetwork.NetworkOptionGeneric(getEmptyGenericOption()))
935 935
 	if err != nil {
936 936
 		// Only fail if we could not find the plugin driver
937
-		if errdefs.IsNotFound(err) {
937
+		if cerrdefs.IsNotFound(err) {
938 938
 			t.Fatal(err)
939 939
 		}
940 940
 		return
... ...
@@ -1112,13 +1112,13 @@ func TestEndpointJoin(t *testing.T) {
1112 1112
 
1113 1113
 	// test invalid joins
1114 1114
 	err = ep1.Join(context.Background(), nil)
1115
-	assert.Assert(t, is.ErrorType(err, errdefs.IsInvalidParameter), "Expected to fail join with nil Sandbox")
1115
+	assert.Assert(t, is.ErrorType(err, cerrdefs.IsInvalidArgument), "Expected to fail join with nil Sandbox")
1116 1116
 	// FIXME(thaJeztah): this error includes the raw data of the sandbox (as `<nil>`), which is not very informative
1117 1117
 	assert.Check(t, is.Error(err, "invalid Sandbox passed to endpoint join: <nil>"))
1118 1118
 
1119 1119
 	fsbx := &libnetwork.Sandbox{}
1120 1120
 	err = ep1.Join(context.Background(), fsbx)
1121
-	assert.Assert(t, is.ErrorType(err, errdefs.IsInvalidParameter), "Expected to fail join with invalid Sandbox")
1121
+	assert.Assert(t, is.ErrorType(err, cerrdefs.IsInvalidArgument), "Expected to fail join with invalid Sandbox")
1122 1122
 
1123 1123
 	//nolint:dupword // ignore "Duplicate words (map[]) found (dupword)"
1124 1124
 	// FIXME(thaJeztah): this error includes the raw data of the sandbox, which is not very human-readable or informative;
... ...
@@ -1434,12 +1434,12 @@ func (pt parallelTester) Do(t *testing.T, thrNumber int) error {
1434 1434
 
1435 1435
 	for i := 0; i < pt.iterCnt; i++ {
1436 1436
 		if err := ep.Join(context.Background(), sb); err != nil {
1437
-			if !errdefs.IsForbidden(err) {
1437
+			if !cerrdefs.IsPermissionDenied(err) {
1438 1438
 				return errors.Wrapf(err, "thread %d", thrNumber)
1439 1439
 			}
1440 1440
 		}
1441 1441
 		if err := ep.Leave(context.Background(), sb); err != nil {
1442
-			if !errdefs.IsForbidden(err) {
1442
+			if !cerrdefs.IsPermissionDenied(err) {
1443 1443
 				return errors.Wrapf(err, "thread %d", thrNumber)
1444 1444
 			}
1445 1445
 		}
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"strconv"
8 8
 	"testing"
9 9
 
10
-	"github.com/docker/docker/errdefs"
10
+	cerrdefs "github.com/containerd/errdefs"
11 11
 	"github.com/docker/docker/internal/testutils/netnsutils"
12 12
 	"github.com/docker/docker/libnetwork/config"
13 13
 	"github.com/docker/docker/libnetwork/drivers/bridge"
... ...
@@ -65,14 +65,14 @@ func TestControllerGetSandbox(t *testing.T) {
65 65
 	t.Run("invalid id", func(t *testing.T) {
66 66
 		const cID = ""
67 67
 		sb, err := ctrlr.GetSandbox(cID)
68
-		assert.Check(t, errdefs.IsInvalidParameter(err), "expected a ErrInvalidParameter, got %[1]v (%[1]T)", err)
68
+		assert.Check(t, cerrdefs.IsInvalidArgument(err), "expected a ErrInvalidParameter, got %[1]v (%[1]T)", err)
69 69
 		assert.Check(t, is.Error(err, "invalid id: id is empty"))
70 70
 		assert.Check(t, is.Nil(sb))
71 71
 	})
72 72
 	t.Run("not found", func(t *testing.T) {
73 73
 		const cID = "container-id-with-no-sandbox"
74 74
 		sb, err := ctrlr.GetSandbox(cID)
75
-		assert.Check(t, errdefs.IsNotFound(err), "expected a ErrNotFound, got %[1]v (%[1]T)", err)
75
+		assert.Check(t, cerrdefs.IsNotFound(err), "expected a ErrNotFound, got %[1]v (%[1]T)", err)
76 76
 		assert.Check(t, is.Error(err, "network sandbox for container container-id-with-no-sandbox not found"))
77 77
 		assert.Check(t, is.Nil(sb))
78 78
 	})
... ...
@@ -92,7 +92,7 @@ func TestControllerGetSandbox(t *testing.T) {
92 92
 		assert.Check(t, err)
93 93
 
94 94
 		sb, err = ctrlr.GetSandbox(cID)
95
-		assert.Check(t, errdefs.IsNotFound(err), "expected a ErrNotFound, got %[1]v (%[1]T)", err)
95
+		assert.Check(t, cerrdefs.IsNotFound(err), "expected a ErrNotFound, got %[1]v (%[1]T)", err)
96 96
 		assert.Check(t, is.Error(err, "network sandbox for container test-container-id not found"))
97 97
 		assert.Check(t, is.Nil(sb))
98 98
 	})
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"strconv"
6 6
 	"testing"
7 7
 
8
-	"github.com/docker/docker/errdefs"
8
+	cerrdefs "github.com/containerd/errdefs"
9 9
 	"gotest.tools/v3/assert"
10 10
 	is "gotest.tools/v3/assert/cmp"
11 11
 )
... ...
@@ -16,31 +16,31 @@ func TestErrorConstructors(t *testing.T) {
16 16
 
17 17
 	err = InvalidParameterErrorf("Io ho %d uccello", 1)
18 18
 	assert.Check(t, is.Error(err, "Io ho 1 uccello"))
19
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
19
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
20 20
 	_, ok = err.(MaskableError)
21 21
 	assert.Check(t, !ok, "error should not be maskable: %[1]v (%[1]T)", err)
22 22
 
23 23
 	err = NotFoundErrorf("Can't find the %s", "keys")
24 24
 	assert.Check(t, is.Error(err, "Can't find the keys"))
25
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
25
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
26 26
 	_, ok = err.(MaskableError)
27 27
 	assert.Check(t, !ok, "error should not be maskable: %[1]v (%[1]T)", err)
28 28
 
29 29
 	err = ForbiddenErrorf("Can't open door %d", 2)
30 30
 	assert.Check(t, is.Error(err, "Can't open door 2"))
31
-	assert.Check(t, is.ErrorType(err, errdefs.IsForbidden))
31
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsPermissionDenied))
32 32
 	_, ok = err.(MaskableError)
33 33
 	assert.Check(t, !ok, "error should not be maskable: %[1]v (%[1]T)", err)
34 34
 
35 35
 	err = NotImplementedErrorf("Functionality %s is not implemented", "x")
36 36
 	assert.Check(t, is.Error(err, "Functionality x is not implemented"))
37
-	assert.Check(t, is.ErrorType(err, errdefs.IsNotImplemented))
37
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsNotImplemented))
38 38
 	_, ok = err.(MaskableError)
39 39
 	assert.Check(t, !ok, "error should not be maskable: %[1]v (%[1]T)", err)
40 40
 
41 41
 	err = UnavailableErrorf("Driver %s is not available", "mh")
42 42
 	assert.Check(t, is.Error(err, "Driver mh is not available"))
43
-	assert.Check(t, is.ErrorType(err, errdefs.IsUnavailable))
43
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsUnavailable))
44 44
 	_, ok = err.(MaskableError)
45 45
 	assert.Check(t, !ok, "error should not be maskable: %[1]v (%[1]T)", err)
46 46
 
... ...
@@ -9,6 +9,7 @@ import (
9 9
 
10 10
 	containerd "github.com/containerd/containerd/v2/client"
11 11
 	"github.com/containerd/containerd/v2/pkg/cio"
12
+	cerrdefs "github.com/containerd/errdefs"
12 13
 	"github.com/containerd/log"
13 14
 	"github.com/docker/docker/errdefs"
14 15
 	"github.com/docker/docker/libcontainerd"
... ...
@@ -61,12 +62,12 @@ type c8dPlugin struct {
61 61
 // deleteTaskAndContainer deletes plugin task and then plugin container from containerd
62 62
 func (p c8dPlugin) deleteTaskAndContainer(ctx context.Context) {
63 63
 	if p.tsk != nil {
64
-		if err := p.tsk.ForceDelete(ctx); err != nil && !errdefs.IsNotFound(err) {
64
+		if err := p.tsk.ForceDelete(ctx); err != nil && !cerrdefs.IsNotFound(err) {
65 65
 			p.log.WithError(err).Error("failed to delete plugin task from containerd")
66 66
 		}
67 67
 	}
68 68
 	if p.ctr != nil {
69
-		if err := p.ctr.Delete(ctx); err != nil && !errdefs.IsNotFound(err) {
69
+		if err := p.ctr.Delete(ctx); err != nil && !cerrdefs.IsNotFound(err) {
70 70
 			p.log.WithError(err).Error("failed to delete plugin container from containerd")
71 71
 		}
72 72
 	}
... ...
@@ -102,14 +103,14 @@ func (e *Executor) Restore(id string, stdout, stderr io.WriteCloser) (bool, erro
102 102
 	p := c8dPlugin{log: log.G(ctx).WithField("plugin", id)}
103 103
 	ctr, err := e.client.LoadContainer(ctx, id)
104 104
 	if err != nil {
105
-		if errdefs.IsNotFound(err) {
105
+		if cerrdefs.IsNotFound(err) {
106 106
 			return false, nil
107 107
 		}
108 108
 		return false, err
109 109
 	}
110 110
 	p.tsk, err = ctr.AttachTask(ctx, attachStreamsFunc(stdout, stderr))
111 111
 	if err != nil {
112
-		if errdefs.IsNotFound(err) {
112
+		if cerrdefs.IsNotFound(err) {
113 113
 			p.deleteTaskAndContainer(ctx)
114 114
 			return false, nil
115 115
 		}
... ...
@@ -117,7 +118,7 @@ func (e *Executor) Restore(id string, stdout, stderr io.WriteCloser) (bool, erro
117 117
 	}
118 118
 	s, err := p.tsk.Status(ctx)
119 119
 	if err != nil {
120
-		if errdefs.IsNotFound(err) {
120
+		if cerrdefs.IsNotFound(err) {
121 121
 			// Task vanished after attaching?
122 122
 			p.tsk = nil
123 123
 			p.deleteTaskAndContainer(ctx)
... ...
@@ -6,8 +6,8 @@ import (
6 6
 	"path/filepath"
7 7
 	"testing"
8 8
 
9
+	cerrdefs "github.com/containerd/errdefs"
9 10
 	"github.com/distribution/reference"
10
-	"github.com/docker/docker/errdefs"
11 11
 	"github.com/opencontainers/go-digest"
12 12
 	"gotest.tools/v3/assert"
13 13
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -162,13 +162,13 @@ func TestAddDeleteGet(t *testing.T) {
162 162
 		t.Fatalf("error redundantly adding to store: %v", err)
163 163
 	}
164 164
 	err = store.AddDigest(ref5.(reference.Canonical), testImageID3, false)
165
-	assert.Check(t, is.ErrorType(err, errdefs.IsConflict), "overwriting a digest with a different digest should fail")
165
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict), "overwriting a digest with a different digest should fail")
166 166
 	err = store.AddDigest(ref5.(reference.Canonical), testImageID3, true)
167
-	assert.Check(t, is.ErrorType(err, errdefs.IsConflict), "overwriting a digest cannot be forced")
167
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict), "overwriting a digest cannot be forced")
168 168
 
169 169
 	// Attempt to overwrite with force == false
170 170
 	err = store.AddTag(ref4, testImageID3, false)
171
-	assert.Check(t, is.ErrorType(err, errdefs.IsConflict), "did not get expected error on overwrite attempt")
171
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict), "did not get expected error on overwrite attempt")
172 172
 	// Repeat to overwrite with force == true
173 173
 	if err = store.AddTag(ref4, testImageID3, true); err != nil {
174 174
 		t.Fatalf("failed to force tag overwrite: %v", err)
... ...
@@ -328,12 +328,12 @@ func TestInvalidTags(t *testing.T) {
328 328
 	ref, err := reference.ParseNormalizedNamed("sha256:abc")
329 329
 	assert.NilError(t, err)
330 330
 	err = store.AddTag(ref, id, true)
331
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
331
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
332 332
 
333 333
 	// setting digest as a tag
334 334
 	ref, err = reference.ParseNormalizedNamed("registry@sha256:367eb40fd0330a7e464777121e39d2f5b3e8e23a1e159342e53ab05c9e4d94e6")
335 335
 	assert.NilError(t, err)
336 336
 
337 337
 	err = store.AddTag(ref, id, true)
338
-	assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
338
+	assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
339 339
 }
... ...
@@ -7,8 +7,8 @@ import (
7 7
 	"runtime"
8 8
 	"testing"
9 9
 
10
+	cerrdefs "github.com/containerd/errdefs"
10 11
 	"github.com/docker/docker/api/types/container"
11
-	"github.com/docker/docker/errdefs"
12 12
 	"github.com/docker/docker/pkg/sysinfo"
13 13
 	"gotest.tools/v3/assert"
14 14
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -99,7 +99,7 @@ func TestDecodeContainerConfigIsolation(t *testing.T) {
99 99
 			cfg, hostConfig, nwConfig, err := decodeContainerConfig(bytes.NewReader(b), sysinfo.New())
100 100
 			if tc.invalid {
101 101
 				assert.Check(t, is.ErrorContains(err, tc.expectedErr))
102
-				assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
102
+				assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
103 103
 				assert.Check(t, is.Nil(cfg))
104 104
 				assert.Check(t, is.Nil(hostConfig))
105 105
 				assert.Check(t, is.Nil(nwConfig))
... ...
@@ -118,7 +118,7 @@ func TestDecodeContainerConfigPrivileged(t *testing.T) {
118 118
 	if runtime.GOOS == "windows" {
119 119
 		const expected = "invalid option: privileged mode is not supported for Windows containers"
120 120
 		assert.Check(t, is.Error(err, expected))
121
-		assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
121
+		assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
122 122
 		assert.Check(t, is.Nil(cfg))
123 123
 		assert.Check(t, is.Nil(hostConfig))
124 124
 		assert.Check(t, is.Nil(nwConfig))
... ...
@@ -5,8 +5,8 @@ package runconfig // import "github.com/docker/docker/runconfig"
5 5
 import (
6 6
 	"testing"
7 7
 
8
+	cerrdefs "github.com/containerd/errdefs"
8 9
 	"github.com/docker/docker/api/types/container"
9
-	"github.com/docker/docker/errdefs"
10 10
 	"github.com/docker/docker/pkg/sysinfo"
11 11
 	"gotest.tools/v3/assert"
12 12
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -77,7 +77,7 @@ func TestValidateResources(t *testing.T) {
77 77
 
78 78
 			err := validateResources(&hc, &si)
79 79
 			if tc.expectedError != "" {
80
-				assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
80
+				assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
81 81
 				assert.Check(t, is.Error(err, tc.expectedError))
82 82
 			} else {
83 83
 				assert.NilError(t, err)
... ...
@@ -4,9 +4,9 @@ import (
4 4
 	"context"
5 5
 	"testing"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	"github.com/docker/docker/api/types"
8 9
 	"github.com/docker/docker/client"
9
-	"github.com/docker/docker/errdefs"
10 10
 	"gotest.tools/v3/poll"
11 11
 )
12 12
 
... ...
@@ -34,7 +34,7 @@ func (d *Daemon) PluginIsNotRunning(t testing.TB, name string) func(poll.LogT) p
34 34
 func (d *Daemon) PluginIsNotPresent(t testing.TB, name string) func(poll.LogT) poll.Result {
35 35
 	return withClient(t, d, func(c client.APIClient, t poll.LogT) poll.Result {
36 36
 		_, _, err := c.PluginInspectWithRaw(context.Background(), name)
37
-		if errdefs.IsNotFound(err) {
37
+		if cerrdefs.IsNotFound(err) {
38 38
 			return poll.Success()
39 39
 		}
40 40
 		if err != nil {
... ...
@@ -57,7 +57,7 @@ func (d *Daemon) PluginReferenceIs(t testing.TB, name, expectedRef string) func(
57 57
 func withPluginInspect(name string, f func(*types.Plugin, poll.LogT) poll.Result) func(client.APIClient, poll.LogT) poll.Result {
58 58
 	return func(c client.APIClient, t poll.LogT) poll.Result {
59 59
 		plugin, _, err := c.PluginInspectWithRaw(context.Background(), name)
60
-		if errdefs.IsNotFound(err) {
60
+		if cerrdefs.IsNotFound(err) {
61 61
 			return poll.Continue("plugin %q not found", name)
62 62
 		}
63 63
 		if err != nil {
... ...
@@ -5,6 +5,7 @@ import (
5 5
 	"strings"
6 6
 	"testing"
7 7
 
8
+	cerrdefs "github.com/containerd/errdefs"
8 9
 	"github.com/docker/docker/api/types"
9 10
 	"github.com/docker/docker/api/types/container"
10 11
 	"github.com/docker/docker/api/types/filters"
... ...
@@ -12,7 +13,6 @@ import (
12 12
 	"github.com/docker/docker/api/types/network"
13 13
 	"github.com/docker/docker/api/types/volume"
14 14
 	"github.com/docker/docker/client"
15
-	"github.com/docker/docker/errdefs"
16 15
 	"github.com/docker/docker/internal/lazyregexp"
17 16
 	"go.opentelemetry.io/otel"
18 17
 	"gotest.tools/v3/assert"
... ...
@@ -82,7 +82,7 @@ func deleteAllContainers(ctx context.Context, t testing.TB, apiclient client.Con
82 82
 			Force:         true,
83 83
 			RemoveVolumes: true,
84 84
 		})
85
-		if err == nil || errdefs.IsNotFound(err) || alreadyExists.MatchString(err.Error()) {
85
+		if err == nil || cerrdefs.IsNotFound(err) || alreadyExists.MatchString(err.Error()) {
86 86
 			continue
87 87
 		}
88 88
 		assert.Check(t, err, "failed to remove %s", ctr.ID)
... ...
@@ -125,7 +125,7 @@ func removeImage(ctx context.Context, t testing.TB, apiclient client.ImageAPICli
125 125
 	_, err := apiclient.ImageRemove(ctx, ref, image.RemoveOptions{
126 126
 		Force: true,
127 127
 	})
128
-	if errdefs.IsNotFound(err) {
128
+	if cerrdefs.IsNotFound(err) {
129 129
 		return
130 130
 	}
131 131
 	assert.Check(t, err, "failed to remove image %s", ref)
... ...
@@ -170,7 +170,7 @@ func deleteAllPlugins(ctx context.Context, t testing.TB, c client.PluginAPIClien
170 170
 	t.Helper()
171 171
 	plugins, err := c.PluginList(ctx, filters.Args{})
172 172
 	// Docker EE does not allow cluster-wide plugin management.
173
-	if errdefs.IsNotImplemented(err) {
173
+	if cerrdefs.IsNotImplemented(err) {
174 174
 		return
175 175
 	}
176 176
 	assert.Check(t, err, "failed to list plugins")
... ...
@@ -4,12 +4,12 @@ import (
4 4
 	"context"
5 5
 	"testing"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	"github.com/docker/docker/api/types/container"
8 9
 	"github.com/docker/docker/api/types/filters"
9 10
 	"github.com/docker/docker/api/types/image"
10 11
 	"github.com/docker/docker/api/types/network"
11 12
 	"github.com/docker/docker/api/types/volume"
12
-	"github.com/docker/docker/errdefs"
13 13
 	"github.com/docker/docker/testutil"
14 14
 	"go.opentelemetry.io/otel"
15 15
 	"gotest.tools/v3/assert"
... ...
@@ -200,7 +200,7 @@ func getExistingPlugins(ctx context.Context, t testing.TB, testEnv *Execution) [
200 200
 	client := testEnv.APIClient()
201 201
 	pluginList, err := client.PluginList(ctx, filters.Args{})
202 202
 	// Docker EE does not allow cluster-wide plugin management.
203
-	if errdefs.IsNotImplemented(err) {
203
+	if cerrdefs.IsNotImplemented(err) {
204 204
 		return []string{}
205 205
 	}
206 206
 	assert.NilError(t, err, "failed to list plugins")
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"strconv"
10 10
 	"testing"
11 11
 
12
-	"github.com/docker/docker/errdefs"
12
+	cerrdefs "github.com/containerd/errdefs"
13 13
 	"github.com/docker/docker/pkg/idtools"
14 14
 	"github.com/docker/docker/quota"
15 15
 	"gotest.tools/v3/assert"
... ...
@@ -240,7 +240,7 @@ func TestVolCreateValidation(t *testing.T) {
240 240
 			if tc.expectedErr == "" {
241 241
 				assert.NilError(t, err)
242 242
 			} else {
243
-				assert.Check(t, errdefs.IsInvalidParameter(err), "got: %T", err)
243
+				assert.Check(t, cerrdefs.IsInvalidArgument(err), "got: %T", err)
244 244
 				assert.ErrorContains(t, err, tc.expectedErr)
245 245
 			}
246 246
 		})
... ...
@@ -4,9 +4,9 @@ import (
4 4
 	"context"
5 5
 	"testing"
6 6
 
7
+	cerrdefs "github.com/containerd/errdefs"
7 8
 	"github.com/docker/docker/api/types/events"
8 9
 	"github.com/docker/docker/api/types/filters"
9
-	"github.com/docker/docker/errdefs"
10 10
 	"github.com/docker/docker/volume"
11 11
 	volumedrivers "github.com/docker/docker/volume/drivers"
12 12
 	"github.com/docker/docker/volume/service/opts"
... ...
@@ -27,7 +27,7 @@ func TestServiceCreate(t *testing.T) {
27 27
 	defer cleanup()
28 28
 
29 29
 	_, err := service.Create(ctx, "v1", "notexist")
30
-	assert.Assert(t, errdefs.IsNotFound(err), err)
30
+	assert.Assert(t, cerrdefs.IsNotFound(err), err)
31 31
 
32 32
 	v, err := service.Create(ctx, "v1", "d1")
33 33
 	assert.NilError(t, err)
... ...
@@ -38,7 +38,7 @@ func TestServiceCreate(t *testing.T) {
38 38
 
39 39
 	_, err = service.Create(ctx, "v1", "d2")
40 40
 	assert.Check(t, IsNameConflict(err), err)
41
-	assert.Check(t, errdefs.IsConflict(err), err)
41
+	assert.Check(t, cerrdefs.IsConflict(err), err)
42 42
 
43 43
 	assert.Assert(t, service.Remove(ctx, "v1"))
44 44
 	_, err = service.Create(ctx, "v1", "d2")
... ...
@@ -146,14 +146,14 @@ func TestServiceGet(t *testing.T) {
146 146
 	assert.Assert(t, is.Len(v.Status, 1), v.Status)
147 147
 
148 148
 	_, err = service.Get(ctx, "test", opts.WithGetDriver("notarealdriver"))
149
-	assert.Assert(t, errdefs.IsConflict(err), err)
149
+	assert.Assert(t, cerrdefs.IsConflict(err), err)
150 150
 	v, err = service.Get(ctx, "test", opts.WithGetDriver("d1"))
151 151
 	assert.NilError(t, err)
152 152
 	assert.Assert(t, is.DeepEqual(created, v))
153 153
 
154 154
 	assert.Assert(t, ds.Register(testutils.NewFakeDriver("d2"), "d2"))
155 155
 	_, err = service.Get(ctx, "test", opts.WithGetDriver("d2"))
156
-	assert.Assert(t, errdefs.IsConflict(err), err)
156
+	assert.Assert(t, cerrdefs.IsConflict(err), err)
157 157
 }
158 158
 
159 159
 func TestServicePrune(t *testing.T) {