def get_clusterdock_container_id():
"""Returns the container ID of the Docker container running clusterdock.
"""
with quiet():
for cgroup in local('cat /proc/self/cgroup', capture=True).stdout.split('\n'):
if 'docker' in cgroup:
return cgroup.rsplit('/')[-1]
# If we get through the loop and never find the cgroup, something has gone very wrong.
raise ContainerNotFoundException('Could not find container name from /proc/self/cgroup.')
评论列表
文章目录