Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
| ... | ... |
@@ -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 |
} |
| ... | ... |
@@ -85,7 +85,7 @@ func (i *ImageService) pullTag(ctx context.Context, ref reference.Named, platfor |
| 85 | 85 |
opts = append(opts, containerd.WithResolver(resolver)) |
| 86 | 86 |
|
| 87 | 87 |
oldImage, err := i.resolveImage(ctx, ref.String()) |
| 88 |
- if err != nil && !errdefs.IsNotFound(err) {
|
|
| 88 |
+ if err != nil && !cerrdefs.IsNotFound(err) {
|
|
| 89 | 89 |
return err |
| 90 | 90 |
} |
| 91 | 91 |
|
| ... | ... |
@@ -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 {
|