0402e0fdbe
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.
33 lines
741 B
Markdown
33 lines
741 B
Markdown
---
|
|
name: docker_container_logs
|
|
kind: function
|
|
lang: go
|
|
domain: infra
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "func DockerContainerLogs(nameOrID string, tail int) (string, error)"
|
|
description: "Obtiene los logs de un contenedor Docker. El parámetro tail limita a las últimas N líneas (0 devuelve todos los logs)."
|
|
tags: [docker, container, logs, infra]
|
|
uses_functions: []
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [fmt, os/exec, strconv]
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "functions/infra/docker_container_logs.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
// Últimas 100 líneas
|
|
logs, err := DockerContainerLogs("my-app", 100)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Println(logs)
|
|
```
|