diff --git a/internal/storage/runtime.go b/internal/storage/runtime.go index 3d46765cab61..2377da6ed72f 100644 --- a/internal/storage/runtime.go +++ b/internal/storage/runtime.go @@ -460,11 +460,22 @@ func (r *runtimeService) StopContainer(ctx context.Context, idOrName string) err if err != nil { return err } - _, err = r.storageImageServer.GetStore().Unmount(container.ID, false) - if err != nil { - log.Debugf(ctx, "Failed to unmount container %q: %v", container.ID, err) - return err + + if _, err := r.storageImageServer.GetStore().Unmount(container.ID, true); err != nil { + if errors.Is(err, storage.ErrContainerUnknown) { + log.Infof(ctx, "Storage for container %s already removed", container.ID) + return nil + } + + if errors.Is(err, storage.ErrLayerUnknown) { + log.Infof(ctx, "Layer for container %s not known", container.ID) + return nil + } + + log.Warnf(ctx, "Failed to unmount container %q: %v", container.ID, err) + return fmt.Errorf("unmount storage: %w", err) } + log.Debugf(ctx, "Unmounted container %q", container.ID) return nil }