genvid.toolbox.DockerTool

class genvid.toolbox.DockerTool

Bases: genvid.toolbox.network.NetworkTool

Handle manipulation of a Docker image archive.

DOCKER_MACHINE_NAME = None

A mirror of DOCKER_MACHINE_NAME, giving the name of the Docker machine.

IMAGE_TEMPLATE = '{image}_{version}_{imageid}.{archfmt}'

Template of an image filename. Must match RE_IMAGE_IMAGEID.

RE_DIRTY_VERSION = re.compile('^(latest|dev|.*[.+]dirty)$')

Determine if an image version is dirty.

Dirty versions include ‘latest’, ‘dev’, or ending with ‘[.+]dirty’. It forces a pull of the image in the job definition.

RE_IMAGE_IMAGEID = re.compile('(?P<image>.+)_(?P<version>[^_]*)_(?P<imageid>[0-9a-f]{12})\\.(?P<archfmt>[^.]*)')

Decompose an image filename into <image>_<version>_<id>.<archfmt>

RE_SUCCESSFUL_BUILD = re.compile('(Successfully built |sha256:)([0-9a-f]+)')

Docker build success-message regular expression.

build_docker(tag, path=None, rm=True, forcerm=True, **kwargs)

Build a Docker image.

Returns the image build.

docker

A Docker client.

get_image_path(image, version, imageid, archfmt='docker')
get_images()
get_images_config(baseurl)
get_latest_images()
set_docker_env()

Set up the Docker environment using Docker machine.

update_image(image: str, version: str = 'latest', clean: bool = False, compress: bool = False)

Update the image archive.

Parameters:
  • image – The name of the image.
  • version – The version of the image.
  • clean – If True, old images will be removed.
  • compress – If True, the image will be compressed.

Changed in version 1.12: Added the compress parameter.

static version_to_imagetag(image, version)

Return a tag suitable for Docker.

class docker.DockerTool

Implementation of genvid.toolbox.DockerTool