Browse Source

Update docker.py

qiaofeng1227 2 years ago
parent
commit
9f1abf0d0d
1 changed files with 7 additions and 3 deletions
  1. 7 3
      appmanage/api/utils/docker.py

+ 7 - 3
appmanage/api/utils/docker.py

@@ -10,10 +10,14 @@ from pathlib import Path
 def get_process_perc(app_name):
     
     process_now = "0%"
+    path = "/data/apps/" + app_name + "/.env"
+    app_version = read_env(path, "APP_VERSION")
     client = docker.from_env()
-    resp = client.api.pull(app_name, stream=True, decode=True)
-    for line in resp:
-      print(json.dumps(line, indent=4))
+    image_name = app_name + ":" + app_version
+    resp = client.api.pull(image_name:, stream=True, decode=True)
+    print(resp)
+    #for line in resp:
+    #  print(json.dumps(line, indent=4))
 
     return process_now