Files
fn_registry/functions/infra/docker_compose_up.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

36 lines
1.1 KiB
Markdown

---
name: docker_compose_up
kind: function
lang: go
domain: infra
version: "1.0.0"
purity: impure
signature: "func DockerComposeUp(composeFile string, detach bool) (string, error)"
description: "Levanta un stack docker-compose desde el archivo dado. Si detach es true ejecuta en background (-d). Retorna el stdout del comando."
tags: [docker, compose, up, infra]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [fmt, os/exec, strings]
tested: true
tests: ["detach true agrega flag -d al comando", "error si composeFile no existe"]
test_file_path: "functions/infra/docker_compose_up_test.go"
file_path: "functions/infra/docker_compose_up.go"
---
## Ejemplo
```go
out, err := DockerComposeUp("./docker-compose.yml", true)
if err != nil {
log.Fatal(err)
}
fmt.Println(out)
```
## Notas
Ejecuta `docker compose -f composeFile up [-d]`. Usa el subcomando `docker compose` (V2), no el binario standalone `docker-compose`. Retorna stdout + stderr combinados para facilitar el debugging. En modo no-detach bloquea hasta que el compose termine (util para stacks efimeros).