Update docker.py

This commit is contained in:
qiaofeng1227 2023-03-10 10:15:47 +08:00 committed by GitHub
parent ef6c329ea3
commit 9e4cfa9bc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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