mirror of
https://github.com/katanemo/plano.git
synced 2026-04-25 08:46:24 +02:00
Fix compatibility issues with podman system (#415)
- "dokcer inspect" doesn't return State/Status if container is not running - "docker remove" is not a command supported by podman - "docker logs" expect -f to be passed before container name
This commit is contained in:
parent
1bbc5d2233
commit
ae6b2bef59
2 changed files with 7 additions and 4 deletions
|
|
@ -15,7 +15,9 @@ def docker_container_status(container: str) -> str:
|
|||
)
|
||||
if result.returncode != 0:
|
||||
return "not found"
|
||||
return json.loads(result.stdout)[0]["State"]["Status"]
|
||||
|
||||
container_status = json.loads(result.stdout)[0]
|
||||
return container_status.get("State", {}).get("Status", "")
|
||||
|
||||
|
||||
def docker_stop_container(container: str) -> str:
|
||||
|
|
@ -27,7 +29,7 @@ def docker_stop_container(container: str) -> str:
|
|||
|
||||
def docker_remove_container(container: str) -> str:
|
||||
result = subprocess.run(
|
||||
["docker", "remove", container], capture_output=True, text=True, check=False
|
||||
["docker", "rm", container], capture_output=True, text=True, check=False
|
||||
)
|
||||
return result.returncode
|
||||
|
||||
|
|
@ -90,9 +92,10 @@ def stream_gateway_logs(follow):
|
|||
"""
|
||||
log.info("Logs from arch gateway service.")
|
||||
|
||||
options = ["docker", "logs", ARCHGW_DOCKER_NAME]
|
||||
options = ["docker", "logs"]
|
||||
if follow:
|
||||
options.append("-f")
|
||||
options.append(ARCHGW_DOCKER_NAME)
|
||||
try:
|
||||
# Run `docker-compose logs` to stream logs from the gateway service
|
||||
subprocess.run(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue