---
title: "Ejecutar en Docker (patrón de la comunidad) | Wantastic Docs"
description: "Ejecuta wantasticd en un contenedor Docker construido a partir de la versión oficial: construye una imagen pequeña, reclámala una vez con genkey y ejecútala en segundo plano. No es una imagen oficial."
url: "https://wantastic.app/es/docs/install-docker"
category: "Install wantasticd"
reading_time: "5 min"
---

# Ejecutar en Docker (patrón de la comunidad)

Ejecuta wantasticd en un contenedor Docker construido a partir de la versión oficial: construye una imagen pequeña, reclámala una vez con genkey y ejecútala en segundo plano. No es una imagen oficial.

> **Outcome:** Un contenedor que construyes tú ejecuta wantasticd, guarda su reclamación en un volumen con nombre, se reinicia automáticamente y aparece como Online en la consola.

## Before you start

- Docker Engine 20.10+ (o Podman) en un host Linux con el controlador TUN.
- Permiso para ejecutar contenedores con --cap-add NET_ADMIN y --device /dev/net/tun.
- Un teléfono o un navegador para iniciar sesión en la consola de Wantastic.

## Instalación rápida (5 minutos)

No hay imagen oficial. Construyes una pequeña a partir de la versión oficial, la reclamas una vez y la ejecutas en segundo plano. No necesitas token.

1. Guarda el Dockerfile de abajo en una carpeta vacía. Define WANTASTIC_ARCH con la CPU de tu host (amd64, arm64 o arm).
2. Construye la imagen y ejecuta genkey una vez con el comando de reclamación. Muestra una Claim URL y un código QR.
3. Escanea el código QR o abre la Claim URL, inicia sesión y haz clic en Claim Device.
4. Cuando muestre "Device claimed", pulsa Ctrl+C. La reclamación queda guardada en el volumen wantastic.
5. Inicia el contenedor en segundo plano con el comando run.

Dockerfile:

```dockerfile
FROM alpine:3.20
ARG WANTASTIC_ARCH=amd64
RUN apk add --no-cache ca-certificates curl \
 && TAG=$(curl -fsSL https://get.wantastic.app/latest | cut -d+ -f1) \
 && mkdir -p /tmp/w \
 && curl -fsSL https://get.wantastic.app/$TAG/wantasticd-linux-$WANTASTIC_ARCH.tar.gz | tar -xz -C /tmp/w \
 && install -m 755 "$(find /tmp/w -name wantasticd -type f | head -n 1)" /usr/local/bin/wantasticd \
 && rm -rf /tmp/w \
 && wantasticd version
ENV WANTASTIC_CONFIG_DIR=/etc/wantastic \
    WANTASTIC_DNS_MODE=off
VOLUME /etc/wantastic
ENTRYPOINT ["wantasticd"]
CMD ["connect", "--config", "/etc/wantastic/config.conf", "--no-auto-update"]
```

Construir y reclamar (una vez):

```bash
docker build -t wantasticd-local --build-arg WANTASTIC_ARCH=amd64 .
docker run -it --rm --hostname office-docker --cap-add NET_ADMIN --device /dev/net/tun -v wantastic:/etc/wantastic wantasticd-local genkey
```

Ejecutar en segundo plano:

```bash
docker run -d --name wantasticd --hostname office-docker --restart unless-stopped --cap-add NET_ADMIN --device /dev/net/tun -v wantastic:/etc/wantastic wantasticd-local
```

*Instalar y reclamar: genkey muestra una Claim URL y un código QR, y luego espera. Cuando haces clic en Claim Device en la consola, muestra "Device claimed". Entonces pulsa Ctrl+C y reinicia el servicio.*

```
$ $ docker run -it --rm --hostname office-docker --cap-add NET_ADMIN --device /dev/net/tun -v wantastic:/etc/wantastic wantasticd-local genkey
…
…
Generated device claim key: /etc/wantastic/device-claim-key.json
Public key: Vd3hK1oQ7mR2sT9uW4xY6zA8bC0dE2fG4hJ6kL8mN0P=
Server URL: https://console.wantastic.app
Claim URL: https://console.wantastic.app/#desktop?claim_public_key=Vd3hK1oQ…%3D&wantastic_server=https%3A%2F%2Fconsole.wantastic.app

█▀▀▀▀▀█ ▄▀▄ ▀█▄ █▀▀▀▀▀█
█ ███ █ ▀█▄▀▄█ █ ███ █
█ ▀▀▀ █ ▄▀█ ▀▄ █ ▀▀▀ █
▀▀▀▀▀▀▀ ▀ ▀ █ ▀ ▀▀▀▀▀▀▀
▀█▄▀▄▀▀█▀▄█▀▄▀▀▄█▀▄▀█▄
█▀▀▀▀▀█ █▄▀▄▀█ ▀▄█ ▄▀
▀▀▀▀▀▀▀ ▀▀ ▀▀▀ ▀▀▀ ▀▀▀

2026/10/29 09:14:03 Waiting for claim. Press Ctrl+C to stop.
2026/10/29 09:15:12 Device claimed. Configuration saved to /etc/wantastic/config.conf
^C
$ $ docker run -d --name wantasticd --hostname office-docker --restart unless-stopped --cap-add NET_ADMIN --device /dev/net/tun -v wantastic:/etc/wantastic wantasticd-local
```

*Console: Claim Wantastic Device. La Claim URL y el código QR rellenan la clave por ti. Solo tienes que hacer clic en Claim Device.*

1. Claim public key ya está rellenado
2. Deja Wantastic server como aparece
3. Haz clic en Claim Device

> **Operational note:** WANTASTIC_DNS_MODE=off impide que el agente cambie el DNS del contenedor, que gestiona Docker. La actualización automática está desactivada en contenedores: reconstruye la imagen para actualizar.

## Comprueba que funciona

1. Ejecuta el comando status. Muestra Status: Connected.
2. Abre Devices en la consola. El dispositivo aparece como Online.

Comprobación:

```bash
docker exec wantasticd wantasticd status
docker logs --tail 20 wantasticd
```

*wantasticd status: Status: Connected y una VPN IP indican que el túnel está activo.*

```
$ $ docker exec wantasticd wantasticd status
Status:        Connected
Version:       v1.0.54+377f3c0
Mode:          TUN (wantastic0)
VPN IPs:       10.200.0.14/32
Public key:    q7ZkV3m1yH0dTn8pXo2bLwR4sE6uJ9cA1fG5hK8iN0M=
Server:        wg.wantastic.app:51820
Exit node:     false
Local access:  false
Auto update:   true
Traffic:       ↓ 18.4 KiB  ↑ 9.2 KiB
Peers:         2 (direct 1, relay 1)
Uptime:        4m12s
```

*Console: Ventana Devices: el nuevo dispositivo aparece con su nombre y pasa a Online en pocos segundos.*

1. Buscar por nombre
2. Status muestra Online
3. La IP de Overlay coincide con wantasticd status
4. Last seen se sigue actualizando

## Docker Compose

- Red predeterminada: solo el contenedor está en el Overlay.
- network_mode: host coloca wantastic0 en el host, así que el propio host es accesible a través del Overlay.

compose.yaml:

```yaml
services:
  wantasticd:
    build:
      context: .
      args:
        WANTASTIC_ARCH: amd64
    image: wantasticd-local
    hostname: office-docker
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    volumes:
      - wantastic:/etc/wantastic
    # network_mode: host   # put wantastic0 on the host itself
volumes:
  wantastic: {}
```

Reclamar una vez y luego iniciar:

```bash
docker compose run --rm wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
docker compose up -d
```

## Actualizar

Reconstruir con la última versión:

```bash
docker build --no-cache -t wantasticd-local --build-arg WANTASTIC_ARCH=amd64 .
docker rm -f wantasticd
# then run the "Run in the background" command again (the volume keeps the claim)
```

## Otras formas de instalar

Solo lo necesitas para automatización o casos especiales. La instalación rápida de arriba es la forma más sencilla.

### Con un token (muchos contenedores)

Inicia sesión una vez en el volumen con un token de Account → Secrets y luego usa el comando run.

Inicio de sesión con token en el volumen:

```bash
docker run --rm --hostname office-docker -v wantastic:/etc/wantastic wantasticd-local login --no-connect --token <TOKEN>
```

> Trata el token como una contraseña. Quien lo tenga puede añadir dispositivos a tu cuenta hasta que caduque.

*Console: Account → Secrets → + New Secret. El valor del secreto es el token.*

1. Abre la pestaña Secrets
2. Haz clic en + New Secret
3. Ponle un nombre
4. Haz clic en Generate
5. Copia el nuevo secreto

## Verify the result

- docker ps muestra wantasticd Up (no Restarting).
- docker exec wantasticd wantasticd status muestra Status: Connected.
- El dispositivo aparece como Online en Devices.

## Common issues

### El contenedor se detiene de inmediato con un error de TUN.

```
Failed to start agent: create device: create tun: CreateTUN("wantastic0") failed; /dev/net/tun does not exist
```

- **Where:** docker logs
- **Likely cause:** El contenedor se inició sin --device /dev/net/tun o el host no tiene controlador TUN.
- **Fix:** Carga TUN en el host y usa exactamente el comando run de la instalación rápida.

En el host:

```bash
sudo modprobe tun
```

### El contenedor se detiene con un error de permisos.

```
operation not permitted
```

- **Where:** docker logs
- **Likely cause:** Falta la capability NET_ADMIN o el runtime es rootless.
- **Fix:** Añade --cap-add NET_ADMIN. Con Docker rootless o Podman, ejecuta el contenedor como root.

### El contenedor se reinicia en bucle justo después de arrancar.

```
Config not found at /etc/wantastic/config.conf. Run `wantasticd genkey --out <key>` to create a claim key and wait for claim, or pass --wait-claim with an existing key.
```

- **Where:** docker logs
- **Likely cause:** El contenedor nunca se reclamó o usa un volumen distinto.
- **Fix:** Ejecuta el comando de reclamación una vez con el mismo nombre de volumen y vuelve a iniciar el contenedor.

Reclamar:

```bash
docker run -it --rm --hostname office-docker --cap-add NET_ADMIN --device /dev/net/tun -v wantastic:/etc/wantastic wantasticd-local genkey
docker restart wantasticd
```

### Ejecutar install.sh dentro de un contenedor falla al final.

```
System has not been booted with systemd as init system (PID 1). Can't operate.
```

- **Where:** install.sh
- **Likely cause:** Los contenedores no suelen tener systemd.
- **Fix:** Usa el Dockerfile de esta página en lugar del instalador.

### El registro muestra fallos de actualización cada hora.

```
Error: no supported service manager found; refusing an unverifiable update
```

- **Where:** docker logs
- **Likely cause:** La actualización automática está activada, pero un contenedor no tiene gestor de servicios.
- **Fix:** Mantén --no-auto-update en CMD (como en el Dockerfile) y reconstruye la imagen para actualizar.

### Se rechaza la reclamación o el inicio de sesión.

```
Login failed: account has reached its device limit — upgrade your plan or remove an existing device
```

- **Where:** wantasticd login / Consola
- **Likely cause:** Tu plan ha alcanzado el número máximo de dispositivos. La consola muestra "You have reached the maximum number of devices for your plan."
- **Fix:** Elimina un dispositivo que no uses en Devices (fila → Delete) o mejora tu plan. Luego reclama de nuevo.

### status indica Running (tunnel down), o peers muestra HANDSHAKE never para (server).

```
Device health check failed: …
```

- **Where:** registro del servicio
- **Likely cause:** La red bloquea el puerto UDP 51820 saliente hacia el hub (wg.wantastic.app), o el DNS no funciona.
- **Fix:** Permite UDP 51820 saliente en tu firewall y luego reinicia el servicio.

Probar DNS y reiniciar:

```bash
nslookup wg.wantastic.app
docker restart wantasticd
```

- **Verify:** wantasticd peers muestra un handshake reciente (por ejemplo "8s ago") para (server).

## Continue with

- [Manual tarball install](https://wantastic.app/es/docs/install-manual): Install wantasticd by hand from the release archive on any Linux CPU (including ppc64, s390x and loong64), claim it with genkey, and add your own service.
- [Install on Debian and Ubuntu](https://wantastic.app/es/docs/install-debian-ubuntu): Install wantasticd on Debian, Ubuntu, Mint and Proxmox in 2 minutes: one command, scan a QR code, click Claim Device.
- [wantasticd CLI reference and operations](https://wantastic.app/es/docs/wantasticd): The most used wantasticd commands first, then every command and flag, environment variables, config and state paths per OS, log lines, local access, exit node, and the claim flow (genkey / --wait-claim).
- [Self-host WantasticCore](https://wantastic.app/es/docs/self-hosting): Run your own Wantastic console with one command: install, setup wizard, DNS, ports, devices and backups.
- [Connect and runtime errors](https://wantastic.app/es/docs/errors-connect-runtime): Fix service start failures, config errors, TUN problems, missing handshakes and DNS warnings.
- [Update, roll back and uninstall](https://wantastic.app/es/docs/update-and-uninstall): Update or uninstall wantasticd with one line per OS. Also: how auto-update works, turning it off, rolling back to the previous binary, and purging all data.
