mirror of
https://github.com/katanemo/plano.git
synced 2026-05-15 11:02:39 +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
|
|
@ -121,7 +121,7 @@ def stop_arch():
|
||||||
["docker", "stop", ARCHGW_DOCKER_NAME],
|
["docker", "stop", ARCHGW_DOCKER_NAME],
|
||||||
)
|
)
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["docker", "remove", ARCHGW_DOCKER_NAME],
|
["docker", "rm", ARCHGW_DOCKER_NAME],
|
||||||
)
|
)
|
||||||
|
|
||||||
log.info("Successfully shut down arch gateway service.")
|
log.info("Successfully shut down arch gateway service.")
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ def docker_container_status(container: str) -> str:
|
||||||
)
|
)
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
return "not found"
|
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:
|
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:
|
def docker_remove_container(container: str) -> str:
|
||||||
result = subprocess.run(
|
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
|
return result.returncode
|
||||||
|
|
||||||
|
|
@ -90,9 +92,10 @@ def stream_gateway_logs(follow):
|
||||||
"""
|
"""
|
||||||
log.info("Logs from arch gateway service.")
|
log.info("Logs from arch gateway service.")
|
||||||
|
|
||||||
options = ["docker", "logs", ARCHGW_DOCKER_NAME]
|
options = ["docker", "logs"]
|
||||||
if follow:
|
if follow:
|
||||||
options.append("-f")
|
options.append("-f")
|
||||||
|
options.append(ARCHGW_DOCKER_NAME)
|
||||||
try:
|
try:
|
||||||
# Run `docker-compose logs` to stream logs from the gateway service
|
# Run `docker-compose logs` to stream logs from the gateway service
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue