---
name: nordvpn_container_run
kind: function
lang: go
domain: infra
version: "1.0.0"
purity: impure
signature: "func NordVPNContainerRun(opts NordVPNContainerRunOpts) (string, error)"
description: "Ejecuta un container Docker cuyo trafico pasa por el gateway NordVPN usando --network=container:<gateway>. El container hereda la IP y tunel VPN del gateway."
tags: [vpn, nordvpn, docker, container, run, infra, network, pendiente-usar]
uses_functions: ["docker_run_container_go_infra"]
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [fmt]
params:
  - name: opts
    desc: "estructura NordVPNContainerRunOpts con Image, Cmd, Env, Volumes, Detach, Name, Gateway"
output: "ID del contenedor ejecutado bajo VPN"
tested: false
tests: []
test_file_path: ""
file_path: "functions/infra/nordvpn_container_run.go"
---

## Ejemplo

```go
// Verificar IP desde VPN
id, err := NordVPNContainerRun(NordVPNContainerRunOpts{
    Image:   "curlimages/curl",
    Cmd:     []string{"https://api.ipify.org"},
    Remove:  true,
    Gateway: "nordvpn",
})

// Ejecutar scraper bajo VPN
id, err := NordVPNContainerRun(NordVPNContainerRunOpts{
    Image:   "my-scraper:latest",
    Env:     map[string]string{"TARGET_URL": "https://example.com"},
    Volumes: []string{"/tmp/output:/output"},
    Detach:  true,
    Name:    "scraper-vpn",
})

// Navegador headless bajo VPN
id, err := NordVPNContainerRun(NordVPNContainerRunOpts{
    Image:   "chromedp/headless-shell",
    Detach:  true,
    Name:    "chrome-vpn",
})
```

## Notas

Requiere que el container gateway NordVPN este corriendo (usar `NordVPNContainerStart` primero). El container cliente no necesita capabilities especiales — hereda la red del gateway. Con `--network=container:X` el container no puede exponer puertos propios; los puertos deben mapearse en el gateway.
