An image on the server.
Method | __repr__ |
Undocumented |
Method | history |
Show the history of an image. |
Method | remove |
Remove this image. |
Method | save |
Get a tarball of an image. Similar to the ``docker save`` command. |
Method | tag |
Tag this image into a repository. Similar to the ``docker tag`` command. |
Property | labels |
The labels of an image as dictionary. |
Property | short |
The ID of the image truncated to 12 characters, plus the ``sha256:`` prefix. |
Property | tags |
The image's tags. |
Inherited from Model
:
Method | __eq__ |
Undocumented |
Method | __hash__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | reload |
Load this object from the server again and update ``attrs`` with the new data. |
Class Variable | id |
Undocumented |
Instance Variable | attrs |
Undocumented |
Instance Variable | client |
Undocumented |
Instance Variable | collection |
Undocumented |
Property | id |
The ID of the object. |
Show the history of an image. Returns: (str): The history of the image. Raises: :py:class:`docker.errors.APIError` If the server returns an error.
Remove this image. Args: force (bool): Force removal of the image noprune (bool): Do not delete untagged parents Raises: :py:class:`docker.errors.APIError` If the server returns an error.
Get a tarball of an image. Similar to the ``docker save`` command. Args: chunk_size (int): The generator will return up to that much data per iteration, but may return less. If ``None``, data will be streamed as it is received. Default: 2 MB named (str or bool): If ``False`` (default), the tarball will not retain repository and tag information for this image. If set to ``True``, the first tag in the :py:attr:`~tags` list will be used to identify the image. Alternatively, any element of the :py:attr:`~tags` list can be used as an argument to use that specific tag as the saved identifier. Returns: (generator): A stream of raw archive data. Raises: :py:class:`docker.errors.APIError` If the server returns an error. Example: >>> image = cli.images.get("busybox:latest") >>> f = open('/tmp/busybox-latest.tar', 'wb') >>> for chunk in image.save(): >>> f.write(chunk) >>> f.close()
Tag this image into a repository. Similar to the ``docker tag`` command. Args: repository (str): The repository to set for the tag tag (str): The tag name force (bool): Force Raises: :py:class:`docker.errors.APIError` If the server returns an error. Returns: (bool): ``True`` if successful
docker.models.resource.Model.short_id
The ID of the image truncated to 12 characters, plus the ``sha256:`` prefix.