diff --git a/internal/storage/runtime.go b/internal/storage/runtime.go index 5225d5cc4ff3..cdebfb98f1b9 100644 --- a/internal/storage/runtime.go +++ b/internal/storage/runtime.go @@ -455,11 +455,22 @@ func (r *runtimeService) StopContainer(idOrName string) error { if err != nil { return err } - _, err = r.storageImageServer.GetStore().Unmount(container.ID, false) - if err != nil { - logrus.Debugf("Failed to unmount container %q: %v", container.ID, err) + + if errors.Is(err, storage.ErrContainerUnknown) { + logrus.Infof("Container %s not known, assuming it got already removed", container.ID) + return nil + } + + if _, err := r.storageImageServer.GetStore().Unmount(container.ID, true); err != nil { + if errors.Is(err, storage.ErrLayerUnknown) { + logrus.Infof("Layer for container %s not known", container.ID) + return nil + } + + logrus.Warnf("Failed to unmount container %q: %v", container.ID, err) return err } + logrus.Debugf("Unmounted container %q", container.ID) return nil }