Files
fn_registry/python/functions/infra/docker_container_running.md
egutierrez 5194de3c04 feat: cierra issues 0050 y 0052 + commands automáticos
- 0050: jupyter_exec reescrito sin Y.js (REST + KernelClient). Bug raíz adicional: HEAD /api/contents da 405 → cambiado a GET. 9 tests (5 unit + 4 e2e).
- 0052: footprint_aurgi cerrado. Bug fix en setup_geo_stack_docker_pipeline (verify aborta si compose up falla; nombre de contenedor incorrecto).
- Nueva primitiva docker_container_running_py_infra (7 tests).
- /full-git-push y /full-git-pull pasan a modo automático: auto-commit + push sin preguntar, aborta solo si detecta secrets.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 23:34:03 +02:00

2.0 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path
docker_container_running function py infra 1.0.0 impure docker_container_running(name: str, timeout: float = 5.0) -> bool Comprueba si un contenedor Docker existe y está corriendo. True solo si docker inspect retorna State.Running=true. Cualquier fallo (docker ausente, contenedor inexistente, daemon caído, timeout) devuelve False sin excepción.
docker
container
infra
healthcheck
false error_go_core
subprocess
name desc
name Nombre o ID del contenedor a comprobar. Match exacto, no acepta wildcards.
name desc
timeout Timeout en segundos para `docker inspect`. Default 5.0. Si se supera devuelve False.
True si el contenedor existe y está corriendo. False en cualquier otro caso (no existe, está parado, docker no disponible, timeout). true
True para contenedor en ejecución (mock subprocess)
False cuando docker inspect retorna 'false'
False cuando el contenedor no existe (returncode != 0)
False cuando docker no está instalado (FileNotFoundError)
False cuando se excede el timeout (TimeoutExpired)
Integration: comprueba contenedor real si docker disponible
python/functions/infra/tests/test_docker_container_running.py python/functions/infra/docker_container_running.py

Ejemplo

from python.functions.infra.docker_container_running import docker_container_running

if docker_container_running("better_maps_valhalla"):
    print("Valhalla up")
else:
    print("Valhalla down")

Notas

Wrapper minimalista sobre docker inspect -f '{{.State.Running}}'. Pensado como primitiva componible para verificadores de stack y health checks. No lanza excepciones — un fallo de cualquier tipo se reporta como False, dejando que el caller decida qué hacer (skip de test, reintentar, levantar el stack, etc.).