// NewImage returns a types.Image for this reference, possibly specialized for this ImageTransport.
// The caller must call .Close() on the returned Image.
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
func (ref openshiftReference) NewImage(ctx *types.SystemContext) (types.Image, error) {
	src, err := newImageSource(ctx, ref, nil)
	if err != nil {
		return nil, err
	}
	return genericImage.FromSource(src)
}
Beispiel #2
0
// NewImage returns a new Image interface type after setting up
// a client to the registry hosting the given image.
func NewImage(img, certPath string, tlsVerify bool) (types.Image, error) {
	s, err := newDockerImageSource(img, certPath, tlsVerify)
	if err != nil {
		return nil, err
	}
	return &Image{Image: image.FromSource(s, nil), src: s}, nil
}
Beispiel #3
0
// newImage creates an image that also knows its size
func newImage(s storageReference) (types.Image, error) {
	src, err := newImageSource(s)
	if err != nil {
		return nil, err
	}
	img, err := image.FromSource(src)
	if err != nil {
		return nil, err
	}
	size, err := src.getSize()
	if err != nil {
		return nil, err
	}
	return &storageImage{Image: img, size: size}, nil
}
// dirImageMock returns a types.Image for a directory, claiming a specified intendedDockerReference.
func dirImageMock(dir, intendedDockerReference string) types.Image {
	return image.FromSource(&dirImageSourceMock{
		ImageSource:             directory.NewImageSource(dir),
		intendedDockerReference: intendedDockerReference,
	}, nil)
}