diff --git a/internal/app/machined/pkg/system/runner/containerd/containerd.go b/internal/app/machined/pkg/system/runner/containerd/containerd.go index f51accb551..1affb68566 100644 --- a/internal/app/machined/pkg/system/runner/containerd/containerd.go +++ b/internal/app/machined/pkg/system/runner/containerd/containerd.go @@ -15,6 +15,7 @@ import ( "github.com/containerd/containerd" "github.com/containerd/containerd/cio" + "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/oci" @@ -84,6 +85,10 @@ func (c *containerdRunner) Open(ctx context.Context) error { } } + if err = c.client.SnapshotService("").Remove(c.ctx, c.args.ID); err != nil && !errdefs.IsNotFound(err) { + return fmt.Errorf("error cleaning up stale snapshot: %w", err) + } + // Create the container. specOpts := c.newOCISpecOpts(image) containerOpts := c.newContainerOpts(image, specOpts)