Developers
Docker and Docker Compose
Run the official image on a Linux server, with or without a GPU.
CPU only
With PIAP_TOKEN in the environment and docker login done:
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:/datakeeps 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 /tmpkeeps the container file system read-only; it only writes to/dataand/tmp.--stop-timeout 90leaves 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:
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:cudaCheck 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:
docker exec piap-node piap-node status
docker logs -f piap-nodeA fuller example, with a pinned version, a name, a schedule and the metrics port published on the loopback interface only:
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-cpuDocker 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:
umask 077
printf '%s' "$PIAP_TOKEN" > piap_token.txt
sudo chown 65532 piap_token.txtA 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.
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: {}docker compose up -d piap-node
docker compose --profile gpu up -d piap-node-gpu
docker compose psThe healthcheck uses piap-node health: the image has no shell and no curl, on purpose.