Find the image IDs the containers use.

        :return: dict, image tag to docker ID
500469
def get_container_image_ids(self):
        

        statuses = graceful_chain_get(self.json, "status", "containerStatuses")
        if statuses is None:
            return {}

        def remove_prefix(image_id, prefix):
            if image_id.startswith(prefix):
                return image_id[len(prefix):]

            return image_id

        return {status['image']: remove_prefix(status['imageID'], 'docker://')
                for status in statuses}
180642
def get_metadata(self):
        
        inspect_data = self.inspect(refresh=True)
        inspect_to_container_metadata(self.metadata, inspect_data, self.image)

        return self.metadata
794655
def inspect(self):
        
        policy = self.policy
        image_name = format_image_tag((self.config_id.config_name, self.config_id.instance_name))
        image_id = policy.images[self.client_name].get(image_name)
        if image_id:
            self.detail = {'Id': image_id}   # Currently there is no need for actually inspecting the image.
        else:
            self.detail = NOT_FOUND
1223536
def list_images(self):
        
        images = []
        for image in (yield from self.query("GET", "images/json", params={"all": 0})):
            if image['RepoTags']:
                for tag in image['RepoTags']:
                    if tag != "<none>:<none>":
                        images.append({'image': tag})
        return sorted(images, key=lambda i: i['image'])
222195
def get_container_mapping(self):
        
        layout = self.context.getLayout()
        container_mapping = {}
        for slot in layout:
            if slot["type"] != "a":
                continue
            position = slot["position"]
            container_uid = slot["container_uid"]
            container_mapping[container_uid] = position
        return container_mapping
157527
def list_images(self):
        # type: () -> List[str]
        
        r = self.get(self.registry_url + '/v2/_catalog', auth=self.auth)
        return r.json()['repositories']
311517
def running_containers(name_filter: str) -> List[str]:
    
    return [container.short_id for container in
            docker_client.containers.list(filters={"name": name_filter})]
219160
def get_image_info_by_image_id(self, image_id):
        
        logger.info("getting info about provided image specified by image_id '%s'", image_id)
        logger.debug("image_id = '%s'", image_id)
        # returns list of
        # {u'Created': 1414577076,
        #  u'Id': u'3ab9a7ed8a169ab89b09fb3e12a14a390d3c662703b65b4541c0c7bde0ee97eb',
        #  u'ParentId': u'a79ad4dac406fcf85b9c7315fe08de5b620c1f7a12f45c8185c843f4b4a49c4e',
        #  u'RepoTags': [u'buildroot-fedora:latest'],
        #  u'Size': 0,
        #  u'VirtualSize': 856564160}
        images = self.d.images()
        try:
            image_dict = [i for i in images if i['Id'] == image_id][0]
        except IndexError:
            logger.info("image not found")
            return None
        else:
            return image_dict
15718
async def inspect(self, service_id: str) -> Mapping[str, Any]:
        

        response = await self.docker._query_json(
            "services/{service_id}".format(service_id=service_id), method="GET"
        )
        return response
409108
def get_metadata(self):
        
        if self._metadata is None:
            self._metadata = ContainerMetadata()
        inspect_to_container_metadata(self._metadata, self.inspect(refresh=True), self.image)
        return self._metadata
437808
private String findContainerId(String imageNameOrAlias, boolean checkAllContainers) throws DockerAccessException {
        String id = lookupContainer(imageNameOrAlias);

        // check for external container. The image name is interpreted as a *container name* for that case ...
        if (id == null) {
            Container container = queryService.getContainer(imageNameOrAlias);
            if (container != null && (checkAllContainers || container.isRunning())) {
                id = container.getId();
            }
        }
        return id;
    }
39494
def _get_container_id(self, labels):
        
        namespace = CadvisorPrometheusScraperMixin._get_container_label(labels, "namespace")
        pod_name = CadvisorPrometheusScraperMixin._get_container_label(labels, "pod_name")
        container_name = CadvisorPrometheusScraperMixin._get_container_label(labels, "container_name")
        return self.pod_list_utils.get_cid_by_name_tuple((namespace, pod_name, container_name))
143370
def get_branding_ids(self):
        
        if 'brandingIds' not in self.my_osid_object._my_map:
            return IdList([])
        id_list = []
        for idstr in self.my_osid_object._my_map['brandingIds']:
            id_list.append(Id(idstr))
        return IdList(id_list)
748044
def image_present(name):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    if _is_docker_uuid(name) and __salt__['imgadm.docker_to_uuid'](name):
        # docker image was imported
        ret['result'] = True
        ret['comment'] = 'image {0} ({1}) is present'.format(
            name,
            __salt__['imgadm.docker_to_uuid'](name),
        )
    elif name in __salt__['imgadm.list']():
        # image was already imported
        ret['result'] = True
        ret['comment'] = 'image {0} is present'.format(name)
    else:
        # add image
        if _is_docker_uuid(name):
            # NOTE: we cannot query available docker images
            available_images = [name]
        else:
            available_images = __salt__['imgadm.avail']()

        if name in available_images:
            if __opts__['test']:
                ret['result'] = True
                res = {}
                if _is_docker_uuid(name):
                    res['00000000-0000-0000-0000-000000000000'] = name
                else:
                    res[name] = available_images[name]
            else:
                res = __salt__['imgadm.import'](name)
                if _is_uuid(name):
                    ret['result'] = (name in res)
                elif _is_docker_uuid(name):
                    ret['result'] = __salt__['imgadm.docker_to_uuid'](name) is not None
            if ret['result']:
                ret['comment'] = 'image {0} imported'.format(name)
                ret['changes'] = res
            else:
                ret['comment'] = 'image {0} was unable to be imported'.format(name)
        else:
            ret['result'] = False
            ret['comment'] = 'image {0} does not exists'.format(name)

    return ret
417195
def _read_layers(self, layers, image_id):
        

        for layer in self.docker.history(image_id):
            layers.append(layer['Id'])
352722
def build_images():
    # type: () -> None
    
    registry = conf.get('docker.registry')
    docker_images = conf.get('docker.images', [])

    for image in docker_images:
        build_image(registry, image)
964434
def _get_all_lengths(self):
        
        utt_lengths = {}

        for utt_idx in self.utt_ids:
            per_container = [c._file[utt_idx].shape[0] for c in self.containers]
            utt_lengths[utt_idx] = tuple(per_container)

        return utt_lengths