当前位置: 首页>>代码示例>>Python>>正文


Python APIClient.remove_image方法代码示例

本文整理汇总了Python中docker.APIClient.remove_image方法的典型用法代码示例。如果您正苦于以下问题:Python APIClient.remove_image方法的具体用法?Python APIClient.remove_image怎么用?Python APIClient.remove_image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在docker.APIClient的用法示例。


在下文中一共展示了APIClient.remove_image方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _clean_chaincode_images

# 需要导入模块: from docker import APIClient [as 别名]
# 或者: from docker.APIClient import remove_image [as 别名]
def _clean_chaincode_images(worker_api, name_prefix, timeout=5):
    """ Clean chaincode images, whose name should have cluster id as prefix

    :param worker_api: Docker daemon url
    :param name_prefix: image name prefix
    :param timeout: Time to wait for the response
    :return: None
    """
    logger.debug("clean chaincode images with prefix={}".format(name_prefix))
    client = Client(base_url=worker_api, version="auto", timeout=timeout)
    images = client.images()
    id_removes = [e['Id'] for e in images if e['RepoTags'] and
                  e['RepoTags'][0].startswith(name_prefix)]
    logger.debug("chaincode image id to removes=" + ", ".join(id_removes))
    for _ in id_removes:
        client.remove_image(_, force=True)
开发者ID:arindbha,项目名称:cello,代码行数:18,代码来源:docker_swarm.py

示例2: RmContainer

# 需要导入模块: from docker import APIClient [as 别名]
# 或者: from docker.APIClient import remove_image [as 别名]
def RmContainer():
    if GOT_DOCKERPY_API < 2:
        cli = Client()
        try:
            cli.remove_container('suri-buildbot')
        except:
            print "Unable to remove suri-buildbot container"
            pass
        try:
            cli.remove_image('regit/suri-buildbot:latest')
        except:
            print "Unable to remove suri-buildbot images"
            pass
    else:
        cli = DockerClient()
        cli.containers.get('suri-buildbot').remove()
        cli.images.remove('regit/suri-buildbot:latest')
    sys.exit(0)
开发者ID:bmeeks8,项目名称:suricata,代码行数:20,代码来源:prscript.py

示例3: reset_container_host

# 需要导入模块: from docker import APIClient [as 别名]
# 或者: from docker.APIClient import remove_image [as 别名]
def reset_container_host(host_type, worker_api, timeout=15):
    """ Try to detect the daemon type

    Only wait for timeout seconds.

    :param host_type: Type of host: single or swarm
    :param worker_api: Docker daemon url
    :param timeout: Time to wait for the response
    :return: host type info
    """
    try:
        client = Client(base_url=worker_api, version="auto", timeout=timeout)
        containers = client.containers(quiet=True, all=True)
        logger.debug(containers)
        for c in containers:
            client.remove_container(c['Id'], force=True)
        logger.debug("cleaning all containers")
    except Exception as e:
        logger.error("Exception happens when reset host!")
        logger.error(e)
        return False
    try:
        images = client.images(all=True)
        logger.debug(images)
        for i in images:
            if i["RepoTags"][0] == "<none>:<none>":
                logger.debug(i)
                try:
                    client.remove_image(i['Id'])
                except Exception as e:
                    logger.error(e)
                    continue
        logger.debug("cleaning <none> images")
    except Exception as e:
        logger.error("Exception happens when reset host!")
        logger.error(e)
        return False

    return setup_container_host(host_type=host_type, worker_api=worker_api)
开发者ID:arindbha,项目名称:cello,代码行数:41,代码来源:docker_swarm.py


注:本文中的docker.APIClient.remove_image方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。