Developers

Docker and Docker Compose

Run the official image on a Linux server, with or without a GPU.

Updated:

CPU only

With PIAP_TOKEN in the environment and docker login done:

bash
docker run -d --name piap-node --restart unless-stopped --stop-timeout 90 \
  -e PIAP_TOKEN \
  -v piap-data:/data \
  --read-only --tmpfs /tmp \
  registry.piap.io/piap/node:cpu
  • -v piap-data:/data keeps the computer identity and the models: after a restart, the container comes back as the same computer and does not download again.
  • --read-only --tmpfs /tmp keeps the container file system read-only; it only writes to /data and /tmp.
  • --stop-timeout 90 leaves time for the graceful shutdown (60 seconds of grace by default plus shutdown).

With an NVIDIA GPU

The same, with --gpus all and the cuda variant:

bash
docker run -d --name piap-node --restart unless-stopped --stop-timeout 90 \
  --gpus all \
  -e PIAP_TOKEN \
  -v piap-data:/data \
  --read-only --tmpfs /tmp \
  registry.piap.io/piap/node:cuda

Check the status

piap-node status prints the status as JSON (connection, engine, detected accelerator, in-flight requests and models), and logs go to standard output as JSON:

bash
docker exec piap-node piap-node status
docker logs -f piap-node

A fuller example, with a pinned version, a name, a schedule and the metrics port published on the loopback interface only:

bash
docker run -d --name piap-node --restart unless-stopped --stop-timeout 90 \
  -e PIAP_TOKEN \
  -e PIAP_NAME=rack-01 \
  -e PIAP_MAX_CONCURRENT=2 \
  -e PIAP_HOURS=20:00-08:00 -e PIAP_DAYS=1-5 -e TZ=UTC \
  -v piap-data:/data \
  --read-only --tmpfs /tmp \
  -p 127.0.0.1:9090:9090 \
  registry.piap.io/piap/node:0.1.0-cpu

Tags

TagWhat it is
<version>-cpuPinned version, CPU only. Immutable: recommended in production.
<version>-cudaPinned version with NVIDIA GPU. Immutable: recommended in production.
cpuLatest published version, CPU only.
cudaLatest published version, with NVIDIA GPU.
latestSame as cpu.

The first published version is 0.1.0 (0.1.0-cpu and 0.1.0-cuda). Both variants are multi-architecture.

Docker Compose

Store the token in a file that only the container user (UID 65532) can read, and pass it as a secret with PIAP_TOKEN_FILE:

bash
umask 077
printf '%s' "$PIAP_TOKEN" > piap_token.txt
sudo chown 65532 piap_token.txt

A compose.yaml file with the CPU-only service and the GPU variant in the gpu profile. Each service has its own volume: two containers must never share the same /data.

yaml
x-piap-node: &piap-node
  restart: unless-stopped
  read_only: true
  tmpfs:
    - /tmp
  stop_grace_period: 90s
  environment: &piap-env
    PIAP_TOKEN_FILE: /run/secrets/piap_token
    PIAP_NETWORK: prod
    PIAP_MODELS: ""
    PIAP_MAX_MEMORY_PERCENT: "70"
    PIAP_DISK_GB: "40"
    PIAP_MAX_CONCURRENT: "1"
    PIAP_DAILY_TOKENS: "0"
    PIAP_HOURS: "20:00-08:00"
    PIAP_DAYS: "1-5"
    TZ: UTC
    PIAP_YIELD: "off"
    PIAP_OWN_USE: "on"
    PIAP_LOCATION: country
    PIAP_GRACE_SECONDS: "60"
  secrets:
    - piap_token
  healthcheck:
    test: ["CMD", "piap-node", "health"]
    interval: 30s
    timeout: 5s
    retries: 3
    start_period: 120s

services:
  piap-node:
    <<: *piap-node
    image: registry.piap.io/piap/node:0.1.0-cpu
    container_name: piap-node
    environment:
      <<: *piap-env
      PIAP_NAME: rack-01-cpu
    volumes:
      - piap-data:/data

  piap-node-gpu:
    <<: *piap-node
    profiles: ["gpu"]
    image: registry.piap.io/piap/node:0.1.0-cuda
    container_name: piap-node-gpu
    environment:
      <<: *piap-env
      PIAP_NAME: rack-01-gpu
    volumes:
      - piap-data-gpu:/data
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

secrets:
  piap_token:
    file: ./piap_token.txt

volumes:
  piap-data: {}
  piap-data-gpu: {}
bash
docker compose up -d piap-node
docker compose --profile gpu up -d piap-node-gpu
docker compose ps

The healthcheck uses piap-node health: the image has no shell and no curl, on purpose.