Ctrl K
ComunidadGuías…

docker-compose.yml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# unarr agent
#
# Quick start:
#   1. Copy this file to any directory.
#   2. Set UNARR_API_KEY to your key (Settings → API Keys on unarr.app).
#   3. Set DOWNLOAD_DIR to your media folder (absolute path).
#   4. Run:  docker compose up -d
#
# Get your API key: https://unarr.app/settings/api-keys
# Full docs:        https://unarr.app

services:
  unarr:
    image: unarr/cli:latest
    pull_policy: always          # always pull on `up` so you stay on the latest release
    container_name: unarr
    restart: unless-stopped

    # The image ships a HEALTHCHECK, so `docker ps` shows healthy/unhealthy and
    # `docker compose up --wait` blocks until the daemon is actually up rather
    # than merely started. Override it here only if you want different timings;
    # deleting it means a dead daemon shows as "running" forever.
    #
    # It runs `unarr doctor --quick`, which is deliberately network-free — a
    # probe that called the API would flip the container unhealthy on any
    # internet blip and Docker would restart a container that was fine.
    healthcheck:
      test: ["CMD", "unarr", "doctor", "--quick", "--json"]
      interval: 60s
      timeout: 15s
      start_period: 90s
      retries: 3

    # host network is required for:
    #   - streaming to reach your TV / mobile / other LAN devices (port 11818)
    #   - HLS transcode server (port 11819)
    #   - Tailscale connectivity (if you use it)
    # On macOS / Windows Docker Desktop, replace with `ports` mapping (see below).
    network_mode: host

    environment:
      # --- Required ---
      # Removed the agent from Profile → Agents on the web? A plain restart
      # keeps it disconnected. To reconnect it as a new machine, uncomment
      # UNARR_RECONNECT for one restart (see DOCKERHUB.md).
      - UNARR_API_KEY=${UNARR_API_KEY:?Set UNARR_API_KEY in .env or export it}
      # - UNARR_RECONNECT=1

      # --- Optional ---
      # Server URL — change only if you run a self-hosted TorrentClaw instance
      - UNARR_API_URL=${UNARR_API_URL:-https://unarr.app}
      - TZ=${TZ:-UTC}

      # User the agent runs as, and owner of everything it writes. Defaults
      # (1000:1000) suit a typical Linux desktop; NAS boxes need their own:
      #   Synology  → `id <your-user>` in SSH (usually 1024+ / 100)
      #   unRAID    → 99 / 100
      #   QNAP      → `id admin`
      # Wrong values = "permission denied" on /config or /downloads.
      - PUID=${PUID:-1000}
      - PGID=${PGID:-1000}

    volumes:
      # Config: config.toml is auto-created here on first run.
      # After first start, edit this file to set organize paths, quality, etc.
      - ${CONFIG_DIR:-./config}:/config

      # Downloads: where finished media is saved.
      # Set DOWNLOAD_DIR in .env or export it before running.
      - ${DOWNLOAD_DIR:?Set DOWNLOAD_DIR to your media folder}:/downloads

      # Data: piece-completion DB, HLS cache, DHT nodes.
      # Named volume keeps this off your media drive (avoids NFS locking issues).
      - unarr-data:/data

    # --- NVIDIA GPU: hardware transcode (nvenc) ---
    # Uncomment on a host with an NVIDIA GPU + nvidia-container-toolkit. The
    # image already bundles an nvenc-enabled ffmpeg and sets
    # NVIDIA_DRIVER_CAPABILITIES=video,compute,utility, so this device
    # reservation is the only thing needed to enable HW transcode. Without a GPU
    # the same image falls back to software (libx264) automatically — leave it
    # commented.   (docker run equivalent: add  --gpus all)
    # deploy:
    #   resources:
    #     reservations:
    #       devices:
    #         - driver: nvidia
    #           count: all
    #           capabilities: [gpu]
    #     # Optional: cap CPU/RAM for transcoding on shared hosts
    #     limits:
    #       memory: 2G
    #       cpus: "4.0"

    # --- macOS / Windows alternative (replace network_mode: host above) ---
    # network_mode: bridge
    # ports:
    #   - "11818:11818"   # direct stream (VLC, download)
    #   - "11819:11819"   # HLS transcode (web player)
    #   - "42069:42069"   # BitTorrent incoming peers
    # Note: streaming will only reach devices on the same machine.
    # For LAN / Tailscale playback use a Linux host with network_mode: host.

volumes:
  unarr-data: