'Get the config for all docker containers running on the host.'

def get_configs(self):

    configs = {}
    state = self._make_fetch_state()
    containers = [(self.dockerutil.image_name_extractor(container), container.get('Id'), container.get('Labels')) for container in self.docker_client.containers()]
    for (image, cid, labels) in containers:
        try:
            identifier = self.get_config_id(image, labels)
            check_configs = (self._get_check_configs(state, cid, identifier, labels) or [])
            for conf in check_configs:
                (source, (check_name, init_config, instance)) = conf
                if (configs.get(check_name) is None):
                    if isinstance(instance, list):
                        configs[check_name] = (source, (init_config, instance))
                    else:
                        configs[check_name] = (source, (init_config, [instance]))
                else:
                    conflict_init_msg = 'Different    versions    of    `init_config`    found    for    check    {}.    Keeping    the    first    one    found.'
                    if (configs[check_name][1][0] != init_config):
                        log.warning(conflict_init_msg.format(check_name))
                    if isinstance(instance, list):
                        for inst in instance:
                            configs[check_name][1][1].append(inst)
                    else:
                        configs[check_name][1][1].append(instance)
        except Exception:
            log.exception(('Building    config    for    container    %s    based    on    image    %s    using    service    discovery    failed,    leaving    it    alone.' % (cid[:12], image)))
    return configs
