def status(args):
with os.popen("docker inspect -f '{{json .State}}' " + args.container + " 2>&1") as pipe:
status = pipe.read().strip()
if "No such image or container" in status:
print "0"
else:
statusjs = json.loads(status)
if statusjs["Running"]:
print "1"
elif statusjs["ExitCode"] == 0:
print "2"
else:
print "3"
# get the uptime in seconds, if the container is running
discover.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录