docker_pkg.image

Manipulation of Docker images

Functions

pushd(dirname)

Changes the current directory of execution.

Classes

DockerImage(directory, client, config[, nocache])

High-level management of docker images.

DockerImageBase(name, tag, client, config, …)

Lower-level management of docker images

docker_pkg.image.pushd(dirname)[source]

Changes the current directory of execution.

class docker_pkg.image.DockerImageBase(name, tag, client, config, directory, tpl, build_path, nocache=True)[source]

Bases: object

Lower-level management of docker images

name

Canonical Image name including registry and namespace

safe_name

A filesystem-friendly identified

image

Image label <name:tag>

prune()[source]

Removes all old versions of the image from the local docker daemon.

returns True if successful, False otherwise

exists()[source]

True if the image is present locally, false otherwise

extract(src, dst)[source]

Extract a path from an image to the filesystem

remove_container(name)[source]

Removes the named container if it exists.

buildargs
build(build_path, filename='Dockerfile')[source]

Builds the image

Parameters: build_path - context where the build must be performed filename - the file to output the generated dockerfile to

Returns the image label Raises an error if the build fails

clean()[source]

Remove the image if needed

class docker_pkg.image.DockerImage(directory, client, config, nocache=True)[source]

Bases: docker_pkg.image.DockerImageBase

High-level management of docker images.

If a Dockerfile.build.template is present, the build image will be built first, and artifacts will be extracted from it

TEMPLATE = 'Dockerfile.template'
BUILD_TEMPLATE = 'Dockerfile.build.template'
NIGHTLY_BUILD_FORMAT = '%Y%m%d'
is_nightly = False
read_metadata(path)[source]
new_tag(identifier='s')[source]

Create a new version tag from the currently read tag

create_update(reason, version=None)[source]
depends
build()[source]

Build the image.

returns True if successful, False otherwise