def inspect_container(self, service_name): container_id = self.container_id(service_name) client = get_docker_client() return client.inspect_container(container_id)
def remove_container(self, service_name): container_id = self.container_id(service_name) client = get_docker_client() client.remove_container(container_id, force=True)
def container_id(self, service_name): client = get_docker_client() return _get_container_for_app_or_service(client, service_name, include_exited=True)['Id']
def _image_exists(self, image_to_find): client = get_docker_client() all_images = client.images(all=True) return any(image_to_find in image['RepoTags'] for image in all_images)
def exec_in_container(self, service_name, command): client = get_docker_client() container = _get_container_for_app_or_service(client, service_name, raise_if_not_found=True) return _exec_in_container(client, container, *command.split(' '))
def _container_exists_in_set(self, service_name, include_exited): client = get_docker_client() container = _get_container_for_app_or_service(client, service_name, include_exited=include_exited) return bool(container)