Files
fn_registry/functions/infra/stop_app.md
T
egutierrez 1d45f232c6 feat: funciones infra — Docker, deploy, build y health check
Funciones impuras para gestión de contenedores: docker_build_image,
docker_compose_up/down, docker_volume_create/list/remove,
generate_dockerfile, write_dockerfile, go_build_binary, health_check_http,
deploy_app y stop_app. Todas con tests unitarios donde aplica.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 14:24:12 +02:00

39 lines
1.2 KiB
Markdown

---
name: stop_app
kind: pipeline
lang: go
domain: infra
version: "1.0.0"
purity: impure
signature: "func StopApp(containerName string, removeImage bool) error"
description: "Para y elimina el contenedor de una app desplegada. Si removeImage es true elimina también la imagen Docker. containerName debe coincidir con el imageName usado en deploy_app."
tags: [docker, stop, remove, deploy, pipeline, infra, container]
uses_functions: [docker_stop_container_go_infra, docker_remove_container_go_infra, docker_remove_image_go_infra]
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [fmt]
tested: false
tests: []
test_file_path: ""
file_path: "functions/infra/stop_app.go"
---
## Ejemplo
```go
// Parar contenedor sin eliminar la imagen (para relanzar rapido)
err := StopApp("myapp", false)
// Parar y limpiar todo
err = StopApp("myapp", true)
if err != nil {
log.Fatal(err)
}
```
## Notas
Inverso de deploy_app. El contenedor se detiene con 10 segundos de gracia antes de SIGKILL. La imagen se busca como containerName:latest (convencion de deploy_app). Si solo se quiere parar sin limpiar, usar removeImage=false para conservar la imagen en cache local y acelerar el siguiente deploy.