diff --git a/libpod/storage.go b/libpod/storage.go index 52d5e1e8f7..3f667c3199 100644 --- a/libpod/storage.go +++ b/libpod/storage.go @@ -66,21 +66,17 @@ func (metadata *RuntimeContainerMetadata) SetMountLabel(mountLabel string) { metadata.MountLabel = mountLabel } -// CreateContainerStorage creates the storage end of things. We already have the container spec created +// CreateContainerStorage creates the storage end of things. We already have the container spec created. +// imageID and imageName must both be either empty or non-empty. // TO-DO We should be passing in an Image object in the future. func (r *storageService) CreateContainerStorage(ctx context.Context, systemContext *types.SystemContext, imageName, imageID, containerName, containerID string, options storage.ContainerOptions) (_ ContainerInfo, retErr error) { var imageConfig *v1.Image - if imageName != "" { - var ref types.ImageReference + if imageID != "" { if containerName == "" { return ContainerInfo{}, define.ErrEmptyID } // Check if we have the specified image. - ref, err := istorage.Transport.ParseStoreReference(r.store, imageID) - if err != nil { - return ContainerInfo{}, err - } - _, img, err := istorage.ResolveReference(ref) + ref, err := istorage.Transport.NewStoreReference(r.store, nil, imageID) if err != nil { return ContainerInfo{}, err } @@ -96,12 +92,6 @@ func (r *storageService) CreateContainerStorage(ctx context.Context, systemConte if err != nil { return ContainerInfo{}, err } - - // Update the image name and ID. - if imageName == "" && len(img.Names) > 0 { - imageName = img.Names[0] - } - imageID = img.ID } // Build metadata to store with the container.