988e901066
Añade campos params y output al frontmatter YAML de las 506 funciones del registry. Cada parámetro tiene descripción semántica (qué representa, unidades, rango típico) y cada función describe qué produce su output. Permite a agentes razonar sobre cadenas de composición (ej: prices → log_return → sharpe_ratio) sin leer código.
47 lines
1.3 KiB
Markdown
47 lines
1.3 KiB
Markdown
---
|
|
name: docker_run_container
|
|
kind: function
|
|
lang: go
|
|
domain: infra
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "func DockerRunContainer(image string, opts DockerRunOpts) (string, error)"
|
|
description: "Ejecuta un contenedor Docker nuevo a partir de una imagen. Soporta puertos, env vars, volumes, network, detach y auto-remove. Devuelve el ID del contenedor."
|
|
tags: [docker, container, run, infra]
|
|
uses_functions: []
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [fmt, os/exec, strings]
|
|
params:
|
|
- name: image
|
|
desc: "referencia de imagen Docker (nombre:tag)"
|
|
- name: opts
|
|
desc: "estructura DockerRunOpts con Name, Ports, Env, Volumes, Network, Detach, AutoRemove"
|
|
output: "ID del contenedor Docker creado y ejecutado"
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "functions/infra/docker_run_container.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
id, err := DockerRunContainer("nginx:latest", DockerRunOpts{
|
|
Name: "web-server",
|
|
Ports: []string{"8080:80"},
|
|
Env: map[string]string{"NGINX_HOST": "localhost"},
|
|
Detach: true,
|
|
})
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Println("Container ID:", id)
|
|
```
|
|
|
|
## Notas
|
|
|
|
`DockerRunOpts` es un struct de opciones definido en el mismo archivo. No se registra como tipo del registry porque es específico de esta función.
|