feat: 10 funciones infra Docker y 2 tipos — operaciones de contenedores e imagenes
Funciones Docker: list/start/stop/remove containers, list/pull/remove images, inspect, logs, run. Tipos: ContainerInfo e ImageInfo. Pre-existentes en el dominio infra, ahora registrados.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: docker_list_containers
|
||||
kind: function
|
||||
lang: go
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func DockerListContainers(all bool) ([]ContainerInfo, error)"
|
||||
description: "Lista contenedores Docker locales. Si all es true incluye contenedores detenidos. Parsea la salida JSON de docker ps."
|
||||
tags: [docker, container, list, infra]
|
||||
uses_functions: []
|
||||
uses_types: [container_info_go_infra]
|
||||
returns: [container_info_go_infra]
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [encoding/json, fmt, os/exec]
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/infra/docker_list_containers.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
containers, err := DockerListContainers(true)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for _, c := range containers {
|
||||
fmt.Printf("%s %s %s\n", c.ID, c.Name, c.Status)
|
||||
}
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Usa `docker ps --format '{{json .}}'` para parsear la salida de forma confiable. Incluye helpers internos `splitLines` y `parseLabels`.
|
||||
Reference in New Issue
Block a user