本文整理汇总了Python中dockertest.containers.DockerContainers.list_container_ids方法的典型用法代码示例。如果您正苦于以下问题:Python DockerContainers.list_container_ids方法的具体用法?Python DockerContainers.list_container_ids怎么用?Python DockerContainers.list_container_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dockertest.containers.DockerContainers
的用法示例。
在下文中一共展示了DockerContainers.list_container_ids方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cleanup
# 需要导入模块: from dockertest.containers import DockerContainers [as 别名]
# 或者: from dockertest.containers.DockerContainers import list_container_ids [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")
示例2: cleanup
# 需要导入模块: from dockertest.containers import DockerContainers [as 别名]
# 或者: from dockertest.containers.DockerContainers import list_container_ids [as 别名]
def cleanup(self):
super(insert, self).cleanup()
if self.config['remove_after_test']:
dc = DockerContainers(self)
try:
cl = dc.list_container_ids()
except ValueError:
pass
else:
dkrcmd = DockerCmd(self, 'kill', cl)
dkrcmd.execute()
dkrcmd = DockerCmd(self, 'rm', cl)
dkrcmd.execute()
dkrcmd = DockerCmd(self, 'rmi', ['--force',
self.stuff['inserted_image']])
dkrcmd.execute()