docker_pkg.drivers

Functions

get(config, **kwargs)

Factory method to get the driver.

pushd(dirname)

Changes the current directory of execution.

Classes

DockerDriver(config, label, client[, nocache])

Lower-level management of docker images

DriverInterface(config, label)

Method generated by attrs for class DriverInterface.

docker_pkg.drivers.pushd(dirname: str)[source]

Changes the current directory of execution.

class docker_pkg.drivers.DriverInterface(config: Dict[str, Any], label: ImageLabel)[source]

Bases: object

Method generated by attrs for class DriverInterface.

config: Dict[str, Any]
label: ImageLabel
property buildargs: Dict[str, str]
do_build(build_path: str, filename: str = 'Dockerfile') str[source]

Given a build context and a dockerfile, build an image and return its label

exists() bool[source]

Check if a container image exists locally.

publish(tags: List[str]) bool[source]
clean()[source]

Remove the current image

prune()[source]

Remove all old version of the selected image stored locally

add_tag(lbl: ImageLabel, tag: str)[source]

Add a new tag to a docker image

class docker_pkg.drivers.DockerDriver(config: Dict[str, Any], label: ImageLabel, client: DockerClient, nocache: bool = True)[source]

Bases: DriverInterface

Lower-level management of docker images

Method generated by attrs for class DockerDriver.

config: Dict[str, Any]
label: ImageLabel
client: DockerClient
nocache: bool
do_build(build_path: str, filename: str = 'Dockerfile') str[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

publish(tags) bool[source]

Publish a list of tags using docker push

prune() bool[source]

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

returns True if successful, False otherwise

exists() bool[source]

True if the image is present locally, false otherwise

add_tag(label: ImageLabel, tag: str)[source]

Add a new tag to a docker image

docker_pkg.drivers.get(config: Dict[str, Any], **kwargs) DriverInterface[source]

Factory method to get the driver.