helperFunctions.docker module

helperFunctions.docker.run_docker_container(image, logging_label='Docker', timeout=300, combine_stderr_stdout=False, **kwargs)

This is a convenience function that runs a docker container and returns a subprocess.CompletedProcess instance for the command ran in the container. All remaining keyword args are passed to docker.containers.run.

Parameters:
  • image (str) – The name of the docker image

  • logging_label (str) – Label used for logging

  • timeout (int) – Timeout after which the execution is canceled

  • combine_stderr_stdout (bool) – Whether to combine stderr and stdout or not

Returns:

A subprocess.CompletedProcess instance for the command ran in the container.

Raises:
  • docker.errors.ImageNotFound – If the docker image was not found

  • requests.exceptions.ReadTimeout – If the timeout was reached

  • docker.errors.APIError – If the communication with docker fails

Return type:

CompletedProcess