Helper functions

You can find some high-level functions defined in this submodule.

conu.helpers.get_container_output(backend, image_name, command, image_tag='latest', additional_opts=None)

Create a throw-away container based on provided image and tag, run the supplied command in it and return output. The container is stopped and removed after it exits.

Parameters
  • backend – instance of DockerBackend

  • image_name – str, name of the container image

  • command – list of str, command to run in the container

  • image_tag – str, container image tag, defaults to “latest”

  • additional_opts – list of str, by default this function creates the container using docker binary and run command; with this argument you can supply addition options to the “docker run” invocation

Returns

str (unicode), output of the container