Image¶
Image represents abstract API for image managers. It is now implemented by conu.DockerImage
-
class
conu.apidefs.image.
Image
(image_reference, tag=None)¶ A class which represents an arbitrary container image. It contains utility methods to manipulate it.
-
__init__
(image_reference, tag=None)¶ Parameters: - image_reference – str, the reference to this image (usually name)
- tag – str, tag of the image, when not specified, “latest” is implied
-
create_container
(container_params)¶ create a container using this image
Parameters: container_params – instance of ContainerParameters Returns: instance of Container
-
directory_is_present
(directory_path)¶ check if directory specified via ‘directory_path’ is present inside the image; this method raises ConuException if the path exists but is not a directory
Parameters: directory_path – str, directory to check Returns: True if directory exists, False if directory does not exist
-
file_is_present
(file_path)¶ check if file specified via ‘file_path’ is present in the image
Parameters: file_path – str, path to the file Returns: True if file exists, False if the file is missing
-
get_full_name
()¶ provide full, complete image name
Returns: str
-
get_id
()¶ get unique identifier of this image
Returns: str
-
get_metadata
()¶ return general metadata for image
Returns: ImageMetadata
-
get_selinux_context
(file_path)¶ return a permissions for ‘file_path’
Parameters: file_path – str, path to the file Returns: str
-
inspect
(refresh=False)¶ return cached metadata by default
Parameters: refresh – bool, update the metadata with up to date content Returns: dict
-
classmethod
load_from_file
(file_path)¶ load Image from provided file
Parameters: file_path – str, path to the file Returns: Image instance
-
mount
(mount_point=None)¶ mount image filesystem
Parameters: mount_point – str, directory where the filesystem will be mounted Returns: instance of Filesystem
-
mount_image
(mount_point=None)¶ mount an image to host system :param mount_point: str, mount_point on host system :return: mount_point
-
pull
()¶ pull this image
Returns: None
-
rmi
(force=False, via_name=False)¶ remove selected image
Parameters: - image – str, image name, example: “fedora:latest”
- force – bool, force removal of the image
- via_name – bool, refer to the image via name, if false, refer via ID
Returns: None
-
run_in_pod
(namespace='default')¶ run image inside Kubernetes Pod :param namespace: str, name of namespace where pod will be created :return: Pod instance
-
run_via_api
(container_params)¶ create a container using this image and run it in the background
Parameters: container_params – instance of ContainerParameters Returns: instance of Container
-
run_via_binary
(*args, **kwargs)¶ create a container using this image and run it in the background; this method is useful to test real user scenarios when users invoke containers using binary and not an API
Parameters: image – instance of Image Returns: instance of Container
-
Image represents abstract API for s2i images. It is now implemented by conu.S2IDockerImage
-
class
conu.apidefs.image.
S2Image
¶ Additional functionality related to s2i-enabled container images
-
extend
(source, new_image_name, s2i_args=None)¶ extend this s2i-enabled image using provided source, raises ConuException if s2i build fails
Parameters: - source – str, source used to extend the image, can be path or url
- new_image_name – str, name of the new, extended image
- s2i_args – list of str, additional options and arguments provided to s2i build
Returns: S2Image instance
-
usage
()¶ Provide output of s2i usage
Returns: str
-