本文整理汇总了Python中DockerBackend.attach_to_docker_client方法的典型用法代码示例。如果您正苦于以下问题:Python DockerBackend.attach_to_docker_client方法的具体用法?Python DockerBackend.attach_to_docker_client怎么用?Python DockerBackend.attach_to_docker_client使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DockerBackend
的用法示例。
在下文中一共展示了DockerBackend.attach_to_docker_client方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_untagged
# 需要导入模块: import DockerBackend [as 别名]
# 或者: from DockerBackend import attach_to_docker_client [as 别名]
def delete_untagged():
"""Find the untagged images and remove them"""
images = c.images()
found = False
for image in images:
if image["RepoTags"] == ["<none>:<none>"]:
found = True
image_id = image["Id"]
print "Deleting untagged image\nhash=", image_id
try:
c.remove_image(image["Id"])
except docker.errors.APIError as error:
print "Failed to delete image\nhash={}\terror={}", image_id, error
if not found:
print "Didn't find any untagged images to delete!"
@manager.command
def check_users():
"""list all usernames and emails"""
users = dhbox.User.query.all()
for user in users:
print user.name
print user.email
c = DockerBackend.attach_to_docker_client()
if __name__ == '__main__':
manager.main()