GPU process monitor compose example.
Educational example only. Review every volume path, port, and credential before you run this. Do not copy production secrets into your wiki or git repo.
_shared/.env for non-secrets, _shared/.secret for credentialsmkdir -p /path/to/docker/stacks/nvtop
cd /path/to/docker/stacks/nvtop
# paste compose.yaml below, then:
docker compose pull
docker compose up -d
---
services:
nvtop:
image: 69guitar1015/nvtop:latest # Simple pre-built image
container_name: nvtop
hostname: nvtop
env_file:
- /path/to/docker/stacks/_shared/.env
- /path/to/docker/stacks/_shared/.secret
# Alternative: build from source if you prefer
# build:
# context: https://github.com/Syllo/nvtop.git
# dockerfile: Dockerfile
# Required for NVIDIA GPU access in Docker Compose
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all # or specify '1' / device_ids: ['0']
capabilities: [gpu, utility, compute]
# Alternative older syntax (if the above doesn't work on your version):
# runtime: nvidia
# environment:
# - NVIDIA_VISIBLE_DEVICES=all
# - NVIDIA_DRIVER_CAPABILITIES=all
# Interactive TUI + host PID namespace for best GPU monitoring
stdin_open: true
tty: true
pid: host
# Optional: privileged if you hit permission issues (rarely needed)
# privileged: true
restart: unless-stopped
_shared/.secret.