discover.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:docker-monitoring-zabbix-agent 作者: digiapulssi 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号