diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 3551613a1f..87d8484783 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -1412,13 +1412,13 @@ func (r *Runtime) IsStorageContainerMounted(id string) (bool, string, error) { mountCnt, err := r.storageService.MountedContainerImage(id) if err != nil { - return false, "", err + return false, "", fmt.Errorf("get mount count of container: %w", err) } mounted := mountCnt > 0 if mounted { path, err = r.storageService.GetMountpoint(id) if err != nil { - return false, "", err + return false, "", fmt.Errorf("get container mount point: %w", err) } } return mounted, path, nil diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 6c9a820996..b6a7baa04d 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -1418,10 +1418,10 @@ func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIDs []strin // This can only happen in a narrow race because we first create the storage // container and then the libpod container so the StorageContainers() call // above would need to happen in that interval. - if errors.Is(err, types.ErrContainerUnknown) || errors.Is(err, define.ErrCtrExists) { + if errors.Is(err, types.ErrContainerUnknown) || errors.Is(err, types.ErrLayerUnknown) || errors.Is(err, define.ErrCtrExists) { continue } - return nil, err + return nil, fmt.Errorf("check if storage container is mounted: %w", err) } var name string @@ -1449,7 +1449,7 @@ func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIDs []strin errors.Is(err, define.ErrCtrRemoved) { continue } - return nil, err + return nil, fmt.Errorf("check if container is mounted: %w", err) } if mounted {