image

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ref name.Reference, options []remote.Option, auth authn.AuthConfig) error

Delete removes the image from the container registry

Deleting a tag, or a whole repo is not as straightforward as initially planned as DockerHub seems to restrict deleting a single tag for standard users. This might be subject to change, but as of September 2021 it is limited to the business tier. However, there is an API call to delete the whole repository. In case there is only one tag used in a repository, the effect is pretty much the same. For convenience, there is a provider switch to deal with images on DockerHub differently.

DockerHub images:

  • In case the repository only has one tag, the repository is deleted.
  • If there are multiple tags, the tag to be deleted is overwritten with an empty image (to remove the content, and save quota).
  • Edge case would be no tags in the repository, which is ignored.

IBM Container Registry images: Custom delete API call has to be used, since ICR does not support the default registry API for deletions. The credentials need to have an IBM API key, which is used to obtain an identity token that needs to contains the respective authorization token for requests as well as an account identifier to select the IBM account in which the registry namespace and image is located.

Other registries: Use standard spec delete API request to delete the provided tag.

func GetOptions

func GetOptions(ctx context.Context, imageName name.Reference, insecure bool, dockerConfigJSONPath string, userAgent string) ([]remote.Option, *authn.AuthConfig, error)

GetOptions constructs go-containerregistry options to access the remote registry, in addition, it returns the authentication separately which can be an empty object

func LoadImageOrImageIndexFromDirectory

func LoadImageOrImageIndexFromDirectory(directory string) (containerreg.Image, containerreg.ImageIndex, error)

LoadImageOrImageIndexFromDirectory loads an image or an image index from a directory

func LoadImageOrImageIndexFromRegistry

func LoadImageOrImageIndexFromRegistry(imageName name.Reference, options []remote.Option) (containerreg.Image, containerreg.ImageIndex, error)

LoadImageOrImageIndexFromRegistry loads an image or an image index from a registry

func MutateImageOrImageIndex

func MutateImageOrImageIndex(image containerreg.Image, imageIndex containerreg.ImageIndex, annotations map[string]string, labels map[string]string) (containerreg.Image, containerreg.ImageIndex, error)

MutateImageOrImageIndex mutates an image or image index with additional annotations and labels

func PushImageOrImageIndex

func PushImageOrImageIndex(imageName name.Reference, image containerreg.Image, imageIndex containerreg.ImageIndex, options []remote.Option) (string, int64, error)

PushImageOrImageIndex pushes and image or image index and returns the digest and size. The size is only returned for an image.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL