Images

Reference

DockerImages

class aiodocker.images.DockerImages(docker)[source]
build(*, remote: str = 'None', fileobj: BinaryIO = 'None', path_dockerfile: str = 'None', tag: str = 'None', quiet: bool = 'False', nocache: bool = 'False', buildargs: Mapping = 'None', pull: bool = 'False', rm: bool = 'True', forcerm: bool = 'False', labels: Mapping = 'None', stream: typing_extensions.Literal[False] = 'False', encoding: str = 'None') Dict[str, Any][source]
build(*, remote: str = 'None', fileobj: BinaryIO = 'None', path_dockerfile: str = 'None', tag: str = 'None', quiet: bool = 'False', nocache: bool = 'False', buildargs: Mapping = 'None', pull: bool = 'False', rm: bool = 'True', forcerm: bool = 'False', labels: Mapping = 'None', stream: typing_extensions.Literal[True], encoding: str = 'None') AsyncIterator[Dict[str, Any]]

Build an image given a remote Dockerfile or a file object with a Dockerfile inside

Parameters
  • path_dockerfile (Optional[str]) – path within the build context to the Dockerfile

  • remote (Optional[str]) – a Git repository URI or HTTP/HTTPS context URI

  • quiet (bool) – suppress verbose build output

  • nocache (bool) – do not use the cache when building the image

  • rm (bool) – remove intermediate containers after a successful build

  • pull (bool) – downloads any updates to the FROM image in Dockerfiles

  • encoding (Optional[str]) – set Content-Encoding for the file object your send

  • forcerm (bool) – always remove intermediate containers, even upon failure

  • labels (Optional[Mapping]) – arbitrary key/value labels to set on the image

  • fileobj (Optional[BinaryIO]) – a tar archive compressed or not

Return type

Any

coroutine delete(self, name, *, force=False, noprune=False)[source]

Remove an image along with any untagged parent images that were referenced by that image

Parameters
  • name (str) – name/id of the image to delete

  • force (bool) – remove the image even if it is being used by stopped containers or has other tags

  • noprune (bool) – don’t delete untagged parent images

Return type

List

Returns

List of deleted images

export_image(name)[source]

Get a tarball of an image by name or id.

Parameters

name (str) – name/id of the image to be exported

Returns

Streamreader of tarball image

coroutine get(self, name)[source]
Return type

Mapping

coroutine history(self, name)[source]
Return type

Mapping

import_image(data, stream=False)[source]

Import tarball of image to docker.

Parameters

data – tarball data of image to be imported

Returns

Tarball of the image

coroutine inspect(self, name)[source]

Return low-level information about an image

Parameters

name (str) – name of the image

Return type

Mapping

coroutine list(self, **params)[source]

List of images

Return type

Mapping

pull(from_image: str, *, auth: Optional[Union[MutableMapping, str, bytes]] = 'None', tag: str = 'None', repo: str = 'None', stream: typing_extensions.Literal[False] = 'False') Dict[str, Any][source]
pull(from_image: str, *, auth: Optional[Union[MutableMapping, str, bytes]] = 'None', tag: str = 'None', repo: str = 'None', stream: typing_extensions.Literal[True]) AsyncIterator[Dict[str, Any]]

Similar to docker pull, pull an image locally

Parameters
  • fromImage – name of the image to pull

  • repo (Optional[str]) – repository name given to an image when it is imported

  • tag (Optional[str]) – if empty when pulling an image all tags for the given image to be pulled

  • auth (Union[MutableMapping, str, bytes, None]) – special {‘auth’: base64} pull private repo

Return type

Any

push(name: str, *, auth: Union[MutableMapping, str, bytes] = 'None', tag: str = 'None', stream: typing_extensions.Literal[False] = 'False') Dict[str, Any][source]
push(name: str, *, auth: Union[MutableMapping, str, bytes] = 'None', tag: str = 'None', stream: typing_extensions.Literal[True]) AsyncIterator[Dict[str, Any]]
Return type

Any

coroutine tag(self, name, repo, *, tag=None)[source]

Tag the given image so that it becomes part of a repository.

Parameters
  • repo (str) – the repository to tag in

  • tag (Optional[str]) – the name for the new tag

Return type

bool