Add inspect to container debugging

This commit is contained in:
Simon Li
2022-11-27 23:15:20 +00:00
committed by Pris Nasrat
parent 6413268211
commit 967348069f

View File

@@ -45,9 +45,21 @@ def check_container_ready(container_name, timeout=60):
now = time.time() now = time.time()
while True: while True:
try: try:
container_check_output(["exec", "-t", container_name, "id"]) out = container_check_output(["exec", "-t", container_name, "id"])
print(out.decode())
return return
except subprocess.CalledProcessError: except subprocess.CalledProcessError as e:
print(e)
try:
out = container_check_output(["inspect", container_name])
print(out.decode())
except subprocess.CalledProcessError as e:
print(e)
try:
out = container_check_output(["logs", container_name])
print(out.decode())
except subprocess.CalledProcessError as e:
print(e)
if time.time() - now > timeout: if time.time() - now > timeout:
raise RuntimeError(f"Container {container_name} hasn't started") raise RuntimeError(f"Container {container_name} hasn't started")
time.sleep(5) time.sleep(5)