From 9e4cfa9bc6ace5c3aae90f3dc4b7863826354cfd Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Fri, 10 Mar 2023 10:15:47 +0800 Subject: [PATCH] Update docker.py --- appmanage/api/utils/docker.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/appmanage/api/utils/docker.py b/appmanage/api/utils/docker.py index fc0a1735..8a25d056 100644 --- a/appmanage/api/utils/docker.py +++ b/appmanage/api/utils/docker.py @@ -1,5 +1,5 @@ import os, io, sys, platform, shutil, time, json, datetime -import re,docker +import re,docker,requests from api.utils import shell_execute from api.utils import network @@ -19,11 +19,16 @@ def get_process_perc(app_name): port = read_env(path, "APP_HTTP_PORT") if port == "": port = read_env(path, "APP_DB_PORT") - output = shell_execute.execute_command_output_all("curl localhost:" + port) - code = output["code"] - print(output["result"]) - if int(code) == 0 and output["result"].find("Failed") != -1: + else: + port = "9001" + url = "http://localhost:" + port + r = requests.get(url, timeout=5) + code = r.status_code + + if code == 200: process_now = "running" + else: + print "网站初始化未完成,不能访问!" return process_now