dockerreg.models package¶
Submodules¶
dockerreg.models.v1 module¶
-
class
dockerreg.models.v1.ImageV1(api, tag, repository, id=None)[source]¶ Bases:
dockerreg.models.Image
-
class
dockerreg.models.v1.ManifestV1(api, blob={}, raw='{}', media_type=None, repository=None, tag=None, id=None)[source]¶ Bases:
dockerreg.models.Manifest-
architecture¶
-
config¶
-
container¶
-
container_config¶
-
created¶
-
docker_version¶
-
id¶
-
os¶
-
parent¶
-
size¶
-
-
class
dockerreg.models.v1.RegistryV1(api, name=None)[source]¶ Bases:
dockerreg.models.Registry
-
class
dockerreg.models.v1.RepositoryV1(api, repository, registry)[source]¶ Bases:
dockerreg.models.Repository
dockerreg.models.v2 module¶
-
class
dockerreg.models.v2.ImageV2(api, tag, repository, id=None, filebasename=None, arch=<function getgoarch>, oss=<function getgoos>)[source]¶ Bases:
dockerreg.models.Image-
__init__(api, tag, repository, id=None, filebasename=None, arch=<function getgoarch>, oss=<function getgoos>)[source]¶
-
copy_to(repository=None, tag=None, filebasename=None, lazy=True)[source]¶ Copies this image, possibly to a new repository (possibly registry) and/or tag. At least one of these values must be set; otherwise an IllegalArgumentError will be generated. Moreover, they must not be set to the same values as the image has; this will also result in an IllegalArgumentError.
:param
dockerreg.models.Repositoryrepository: adockerreg.models.Repositoryobject, specifying a new repository (and possibly a differentRegistry). :param str tag: a new tag to use for this image.
-
filebasename¶
-
id¶
-
manifest¶
-
-
class
dockerreg.models.v2.ManifestList(api, blob={}, repository=None)[source]¶ Bases:
dockerreg.models.Model
-
class
dockerreg.models.v2.ManifestListV22(api, blob={}, raw=None, media_type=None, repository=None, tag=None, id=None)[source]¶ Bases:
dockerreg.models.v2.ManifestList-
manifests¶
-
schema_version¶
-
-
class
dockerreg.models.v2.ManifestV1Compat(api, blob={}, raw='{}', media_type=None, repository=None, tag=None, id=None)[source]¶
-
class
dockerreg.models.v2.ManifestV21(api, blob={}, raw=None, media_type=None, repository=None, tag=None, id=None)[source]¶ Bases:
dockerreg.models.Manifest,dockerreg.models.SignableMixin-
architecture¶
-
created¶
-
digest¶
-
history¶
-
id¶
-
layers¶
-
raw¶
-
schema_version¶
-
signatures¶
-
-
class
dockerreg.models.v2.ManifestV22(api, blob={}, raw=None, media_type=None, repository=None, tag=None, id=None, manifest_list=None)[source]¶ Bases:
dockerreg.models.Manifest-
__init__(api, blob={}, raw=None, media_type=None, repository=None, tag=None, id=None, manifest_list=None)[source]¶
-
architecture¶
-
config¶
-
config_digest¶
-
config_media_type¶
-
config_size¶
-
created¶
-
digest¶
-
features¶
-
layers¶
-
manifest¶
-
manifest_list¶
-
media_type¶
-
os¶
-
os_features¶
-
os_version¶
-
repository¶
-
schema_version¶
-
size¶
-
variant¶
-
-
class
dockerreg.models.v2.RegistryV2(api, name=None)[source]¶ Bases:
dockerreg.models.Registry-
delete_image(repository, tag, layers=False, arch=<function getgoarch>, oss=<function getgoos>)[source]¶
-
get_image_created(repository, tag, arch=<function getgoarch>, oss=<function getgoos>, filebasename=None)[source]¶
-
get_image_metadata(repository, tag, arch=<function getgoarch>, oss=<function getgoos>)[source]¶ We return a dict of the reference metadata (manifest digest, length, repository name, reference/tag), and then of the image (total size, arch, layers (digest, size),
-
get_image_size(repository, tag, arch=<function getgoarch>, oss=<function getgoos>, filebasename=None)[source]¶
-
get_namespaces(regexp=None)[source]¶ Returns: a listof namespaces in this registry.Return type: list
-
get_repositories(regexp=None, namespace_regexp=None)[source]¶ Returns: a dictof namespace-to-repository-lists in this registry.Return type: dict
-
pull_and_push_image(repository, tag, arch=<function getgoarch>, oss=<function getgoos>, filebasename=None, refresh=False, dst_registry=None, dst_repository=None, dst_tag=None, dst_username=None, dst_password=None, dst_no_verify=None, dst_cert=None, dst_ca_bundle=None, dst_skip_docker_config=False, dst_no_cache=False, dst_cache_file=None)[source]¶ Pulls the repository:tag image from this registry, and pushes it to dstregistry/dstrepository:dsttag. If all dst* parameters are None, an IllegalArgumentError will be raised. If any of the dst* parameters are unspecified, their values will be taken from the current values of the specified image. This allows you to simply re-tag an image; copy it to another repository; or copy it to another repository.
-
pull_image(repository, tag, arch=<function getgoarch>, oss=<function getgoos>, filebasename=None, refresh=False)[source]¶ Pulls the image descriptor and all layers, returning an
Image`representing the downloaded image. If the `filebasenameparameter is set, the raw data will be cached in files instead of in memory.Parameters: - repository (str) – the full name of the image, including the namespace and repository.
- tag (str) – the tag indicating the version of the image.
- arch (str) – a GOARCH architecture string (i.e. amd64); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- filebasename (str) – if set, the image manifest and layers will be cached in files named filebasename.manifest and filebasename.<layer_id>. If the image already exists on disk via filebasename, it will be loaded from disk.
- refresh (bool) – if set False (the default), and if the image exists on disk via filebasename, the image will not be refreshed (i.e., will not be re-pulled from the registry; only layers that are not cached in files will be pulled; the manifest will not be refreshed).
Returns: a
Image.
-
-
class
dockerreg.models.v2.RepositoryV2(api, repository, registry)[source]¶ Bases:
dockerreg.models.Repository-
get_image(tag, arch=<function getgoarch>, oss=<function getgoos>, filebasename=None)[source]¶ Returns an
Image`representing the requested image. If the `filebasenameparameter is set, any downloaded raw data will be cached in files instead of in memory.Parameters: - tag (str) – the tag indicating the version of the image.
- filebasename (str) – if set, the image manifest and layers will be cached in files named filebasename.manifest and filebasename.<layer_id>.
- arch (str) – a GOARCH architecture string (i.e. amd64); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
Returns: a
Image.
Returns: a listof tags in this repository.
-
Module contents¶
-
class
dockerreg.models.Image(api, tag, repository, id=None)[source]¶ Bases:
dockerreg.models.Model-
deleted¶
-
size()[source]¶ Returns: the total size of the blobs/layers that make up the image. Return type: :type:`int`
-
tag¶
-
-
class
dockerreg.models.Manifest(api, blob={}, raw='{}', media_type=None, repository=None, tag=None, id=None)[source]¶ Bases:
dockerreg.models.Model-
media_type¶
-
modify(**kwargs)[source]¶ Modify this manifest. This could mean, for instance, for a v2-1 manifest, to change the repository and/or tag. It is manifest version-defined; but all Manifest subclasses should at least support the repository and tag modification keys.
-
raw¶
-
repository¶
-
tag¶
-
valid_media_types¶
-
verify()[source]¶ Returns: True if verified; None if there is nothing to verify; or throws an Exception if verification fails.
-
version¶
-
-
class
dockerreg.models.Model(api, name, id=None)[source]¶ Bases:
object-
api¶ The
dockerreg.api.BaseApiClientcorresponding to thisModel.
-
-
class
dockerreg.models.Registry(api, name)[source]¶ Bases:
dockerreg.models.Model-
authping()[source]¶ Returns: Trueif the registry is responding and the user is authenticated and authorized to the / URL (i.e. version check);Falseif not.Return type: bool
-
check_image(repository, tag, arch=<function getgoarch>, oss=<function getgoos>)[source]¶ Ensures that the image and its layers are all present in the named repository at the given tag.
Parameters: - repository (str) – the full name of the image, including the namespace and repository.
- tag (str) – the tag indicating the version of the image.
- arch (str) – a GOARCH architecture string (i.e. amd64); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
Returns: 0 if all layers are present in repository; non-zero otherwise.
-
delete_image(repository, tag, layers=False, arch=<function getgoarch>, oss=<function getgoos>)[source]¶ Deletes the image.
Parameters: - repository (str) – the full name of the image, including the namespace and repository.
- tag (str) – the tag indicating the version of the image.
- layers (bool) – True if we should delete layers; defaults to False.
- arch (str) – a GOARCH architecture string (i.e. amd64); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
Returns: None.
-
delete_tag(repository, tag, arch=<function getgoarch>, oss=<function getgoos>)[source]¶ Deletes a tag.
Parameters: - repository (str) – the full name of the image, including the namespace and repository.
- tag (str) – the tag indicating the version of the image.
- arch (str) – a GOARCH architecture string (i.e. amd64); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
Returns: None.
-
get_image_created(repository, tag, arch=<function getgoarch>, oss=<function getgoos>, filebasename=None)[source]¶ Pulls the image descriptor to determine the creation time of the most recent layer (which is effectively the image creation time), returning an :type:`str` specifying created time. If the filebasename parameter is set, the raw data will be cached in files instead of in memory.
Parameters: - repository (str) – the full name of the image, including the namespace and repository.
- tag (str) – the tag indicating the version of the image.
- arch (str) – a GOARCH architecture string (i.e. amd64); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- filebasename (str) – if set, the image manifest (and any layers, if they are fully downloaded) will be cached in files named filebasename.manifest and filebasename.<layer_id>.
Returns: an :type:`str` specifying created time.
-
get_image_metadata(repository, tag, arch=<function getgoarch>, oss=<function getgoos>)[source]¶ Parameters: - repository (str) – the full name of the image, including the namespace and repository.
- tag (str) – the tag indicating the version of the image.
- arch (str) – a GOARCH architecture string (i.e. amd64); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
Returns: an image metadata
dict.
-
get_image_size(repository, tag, arch=<function getgoarch>, oss=<function getgoos>, filebasename=None)[source]¶ Pulls the image descriptor and enough layer content to determine the total size of all layers in the image, returning an :type:`int` specifying the total layer size in bytes. If the filebasename parameter is set, the raw data will be cached in files instead of in memory.
Parameters: - repository (str) – the full name of the image, including the namespace and repository.
- tag (str) – the tag indicating the version of the image.
- arch (str) – a GOARCH architecture string (i.e. amd64); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- filebasename (str) – if set, the image manifest (and any layers, if they are fully downloaded) will be cached in files named filebasename.manifest and filebasename.<layer_id>.
Returns: a
Image.
-
get_namespaces(regexp=None)[source]¶ Return a list of namespaces in this registry, possibly filtered by regexp string.
Parameters: regexp (str) – a regexp to filter over Returns: a listof namespaces in this registry, possibly filtered by regexp.Return type: list
-
get_repositories(regexp=None, namespace_regexp=None)[source]¶ Return a dict of namespaces-to-repository lists in this registry.
Parameters: Returns: a
dictof namespaces, whose values are lists of repositories, in this registry, possibly filtered by regexp.Return type:
Parameters: Returns: a
listof tags in this repository, or a list of tag metadatadict`s if :param metadata: is set to `True.
-
namespaces¶ A
listof namespaces in this registry.
-
pull_and_push_image(repository, tag, arch=<function getgoarch>, oss=<function getgoos>, filebasename=None, refresh=False, dst_registry=None, dst_repository=None, dst_tag=None, dst_username=None, dst_password=None, dst_no_verify=None, dst_cert=None, dst_ca_bundle=None, dst_skip_docker_config=False, dst_no_cache=False, dst_cache_file=None)[source]¶ Pulls the repository:tag image from this registry, and pushes it to dst_registry/dst_repository:dst_tag. If all dst* parameters are None, an IllegalArgumentError will be raised. If any of the dst* parameters are unspecified, their values will be taken from the current values of the specified image. This allows you to simply re-tag an image; copy it to another repository; or copy it to another repository.
-
pull_image(repository, tag, arch=<function getgoarch>, oss=<function getgoos>, filebasename=None)[source]¶ Pulls the image descriptor and all layers, returning an
Image`representing the downloaded image. If the `filebasenameparameter is set, the raw data will be cached in files instead of in memory.Parameters: - repository (str) – the full name of the image, including the namespace and repository.
- tag (str) – the tag indicating the version of the image.
- arch (str) – a GOARCH architecture string (i.e. amd64); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- filebasename (str) – if set, the image manifest and layers will be cached in files named filebasename.manifest and filebasename.<layer_id>.
Returns: a
Image.
-
push_image(repository, tag, filebasename)[source]¶ Pushes the image referenced by filebasename to the given repository and tag.
Parameters: - repository (str) – the full name of the image, including the namespace and repository.
- tag (str) – the tag indicating the version of the image.
- filebasename (str) – if set, the image manifest and layers will be read from the cached copy in files named filebasename.manifest and filebasename.<layer_id>.
-
repositories¶ A
dictof repositories in this registry, keyed by <namespace>/<repository> strings, with valuesdockerreg.models.Repository.
-
tag_image(repository, tag, newtag, arch=<function getgoarch>, oss=<function getgoos>)[source]¶ Applies a new tag to an existing image referenced by its tag.
Parameters: - repository (str) – the full name of the image, including the namespace and repository.
- tag (str) – the tag indicating the version of the image.
- newtag (str) – the new tag to be added.
- arch (str) – a GOARCH architecture string (i.e. amd64); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux); defaults to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
Returns: a
Image.
-
-
class
dockerreg.models.Repository(api, repository, registry)[source]¶ Bases:
dockerreg.models.Model-
get_image(tag, arch=None, oss=None, filebasename=None)[source]¶ Returns an
Image`representing the requested image. If the `filebasenameparameter is set, any downloaded raw data will be cached in files instead of in memory.Parameters: - tag (str) – the tag indicating the version of the image.
- filebasename (str) – if set, the image manifest and layers will be cached in files named filebasename.manifest and filebasename.<layer_id>.
- arch (str) – either None or a GOARCH architecture string (i.e. amd64). Some Registry versions support multi-platform images; if there is a choice, and if you do not specify a value, it will default to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
- oss (str) – a GOOS operating system string (i.e. linux). Some Registry versions support multi-platform images; if there is a choice, and if you do not specify a value, it will default to the platform this library is running on; see https://golang.org/doc/install/source#environment for valid values.
Returns: a
Image.
-
get_reference_metadata(reference)[source]¶ Parameters: reference (str) – a manifest id or digest. Returns: a tag metadata dict.
Returns: a listof tags in this repository, or a list of tag metadatadict`s if :param metadata: is set to `True.
-