---
name: docker_stop_container
kind: function
lang: go
domain: infra
version: "1.0.0"
purity: impure
signature: "func DockerStopContainer(nameOrID string, timeoutSecs int) error"
description: "Detiene un contenedor Docker en ejecución. timeoutSecs controla el tiempo de gracia antes de SIGKILL (0 usa el default de Docker)."
tags: [docker, container, stop, infra]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [fmt, os/exec, strconv, strings]
params:
  - name: nameOrID
    desc: "nombre o ID del contenedor Docker a detener"
  - name: timeoutSecs
    desc: "segundos de gracia antes de SIGKILL (0 usa el default de Docker)"
output: "nil si se detuvo exitosamente, error en caso contrario"
tested: false
tests: []
test_file_path: ""
file_path: "functions/infra/docker_stop_container.go"
---

## Ejemplo

```go
err := DockerStopContainer("my-app", 10)
if err != nil {
    log.Fatal(err)
}
```
