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


Python DockerImages.remove_image_by_id方法代码示例

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


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

示例1: cleanup

# 需要导入模块: from dockertest.images import DockerImages [as 别名]
# 或者: from dockertest.images.DockerImages import remove_image_by_id [as 别名]
 def cleanup(self):
     super(build, self).cleanup()
     # Auto-converts "yes/no" to a boolean
     if (self.config['try_remove_after_test'] and
                                          self.stuff.has_key('image_id')):
         di = DockerImages(self)
         di.remove_image_by_id(self.stuff['image_id'])
         di.remove_image_by_full_name("empty_base_image")
         self.loginfo("Successfully removed test images")
     else:
         self.loginfo("NOT removing image")
开发者ID:xiaoqing-wei,项目名称:autotest-docker,代码行数:13,代码来源:build.py

示例2: cleanup

# 需要导入模块: from dockertest.images import DockerImages [as 别名]
# 或者: from dockertest.images.DockerImages import remove_image_by_id [as 别名]
 def cleanup(self):
     super(build, self).cleanup()
     # Auto-converts "yes/no" to a boolean
     if self.config['try_remove_after_test']:
         dc = DockerContainers(self)
         for cid in dc.list_container_ids():
             dcmd = DockerCmd(self, 'rm', ['--force', '--volumes', cid])
             dcmd.execute()
         di = DockerImages(self)
         if self.stuff.get('image_id') is not None:
             di.remove_image_by_id(self.stuff['image_id'])
         di.remove_image_by_full_name("empty_base_image")
         self.loginfo("Successfully removed test images")
     else:
         self.loginfo("NOT removing image")
开发者ID:Acidburn0zzz,项目名称:autotest-docker,代码行数:17,代码来源:build.py

示例3: run_once

# 需要导入模块: from dockertest.images import DockerImages [as 别名]
# 或者: from dockertest.images.DockerImages import remove_image_by_id [as 别名]
    def run_once(self):
        fqin = self.sub_stuff['fqin']
        self.sub_stuff["images"].append(fqin)
        di = DockerImages(self.parent_subtest)
        try:
            images = di.list_imgs_with_full_name(fqin)
            for i in images:
                di.remove_image_by_id(i.long_id)
        except error.CmdError:
            pass  # removal was the goal
        images = di.list_imgs_with_full_name(fqin)
        if images != []:
            error.TestNAError("Unable to prepare env for test:"
                              " image %s already/still"
                              " exist in docker repository", fqin)

        self.logdebug("Existing images: %s", di.list_imgs_full_name())
        self.loginfo("Executing test commands")

        self.run_command('run', self.sub_stuff['subargs'],
                         'cmdresult_run1')

        self.run_command('rm', [self.sub_stuff["rand_name"]],
                         'cmdresult_rm')

        self.run_command('tag',
                         [fqin, self.sub_stuff["rand_name"].lower()],
                         'cmdresult_tag')

        self.run_command('rmi',
                         [fqin],
                         'cmdresult_rmi')

        self.run_command('run', self.sub_stuff['subargs'],
                         'cmdresult_run2')

        self.run_command('rm', [self.sub_stuff["rand_name"]],
                         'cmdresult_rm2')

        self.run_command('rmi',
                         [self.sub_stuff["rand_name"].lower()],
                         'cmdresult_rmi2')
开发者ID:Acidburn0zzz,项目名称:autotest-docker,代码行数:44,代码来源:run_remote_tag.py

示例4: cleanup

# 需要导入模块: from dockertest.images import DockerImages [as 别名]
# 或者: from dockertest.images.DockerImages import remove_image_by_id [as 别名]
 def cleanup(self):
     super(rmi_base, self).cleanup()
     di = DockerImages(self.parent_subtest)
     # Auto-converts "yes/no" to a boolean
     if (self.config['remove_after_test'] and
             'image_list' in self.sub_stuff):
         for cont in self.sub_stuff["containers"]:
             clean_cont = NoFailDockerCmd(self, "rm",
                                          ['--force', cont],
                                          self.config['docker_rmi_timeout'])
             clean_cont.execute()
         for image in self.sub_stuff["image_list"]:
             # If removal by name fails, try id
             try:
                 try:
                     di.remove_image_by_full_name(image.full_name)
                 except DockerCommandError:
                     di.remove_image_by_id(image.long_id)
             except DockerCommandError:
                 self.logwarning("Image not exist or failed"
                                 " to remove image.")
             self.loginfo("Successfully removed test image")
开发者ID:ldoktor,项目名称:autotest-docker,代码行数:24,代码来源:rmi.py


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