This guide explains how to enable and validate GPU-accelerated Docker containers on Geckoforge v0.3.0.
- NVIDIA GPU (verify with
lspci | grep -i nvidia) - Geckoforge ISO installed with first-boot scripts completed
- Docker installed via
scripts/firstrun-user.sh
┌─────────────────────────────────────┐
│ Container │
│ └─ App (PyTorch, CUDA, Phoenix) │
└─────────────────────────────────────┘
↓ --gpus all
┌─────────────────────────────────────┐
│ Docker Engine + NVIDIA runtime │
│ └─ /etc/docker/daemon.json │
└─────────────────────────────────────┘
↓ CDI devices
┌─────────────────────────────────────┐
│ NVIDIA Container Toolkit (nvidia-ctk) │
│ └─ /etc/cdi/nvidia.yaml │
└─────────────────────────────────────┘
↓
┌─────────────────────────────────────┐
│ Host NVIDIA Driver (zypper) │
│ └─ /usr/bin/nvidia-smi │
└─────────────────────────────────────┘
↓
┌─────────────────────────────────────┐
│ NVIDIA GPU Hardware │
└─────────────────────────────────────┘
firstboot-nvidia.sh installs the correct driver during first boot. Confirm:
nvidia-smi~/git/geckoforge/scripts/docker-nvidia-install.shThe script:
- Adds the NVIDIA container repository
- Installs
nvidia-container-toolkit - Configures Docker's runtime via
nvidia-ctk runtime configure - Restarts Docker
~/git/geckoforge/scripts/docker-nvidia-verify.shThis runs three checks: host driver, Docker runtime, and a CUDA container smoke test.
docker run --rm --gpus all \
docker.io/nvidia/cuda:12.4.0-base-ubuntu22.04 \
nvidia-smidocker run -it --rm --gpus all \
-v "$PWD:/workspace" \
-w /workspace \
docker.io/nvidia/cuda:12.4.0-devel-ubuntu22.04 \
bashInside the container:
nvidia-smi
nvcc --versiondocker run --rm --gpus all \
-v "$PWD:/app" -w /app \
-p 4000:4000 \
docker.io/hexpm/elixir:1.18.4-erlang-28.1-debian-bookworm-20240115 \
mix phx.serverUse the example in examples/systemd-gpu-service/ to generate user services with Docker Compose or plain docker run.
| Symptom | Fix |
|---|---|
docker: Error response from daemon: could not select device driver "nvidia" |
Re-run docker-nvidia-install.sh; check /etc/docker/daemon.json. |
permission denied on /var/run/docker.sock |
Run newgrp docker or log out/in. |
nvidia-smi works on host but not in container |
Run docker-nvidia-verify.sh; ensure CUDA image matches driver (check nvidia-smi output). |
unknown runtime specified nvidia |
sudo systemctl restart docker after running the install script. |
- Update CUDA base images regularly:
docker pull nvidia/cuda:12.4.0-base-ubuntu22.04 - Review
/etc/docker/daemon.jsonafter upgrades to ensure the NVIDIA runtime is still configured. - For multi-GPU systems, use
--gpus "device=GPU-UUID"or--gpus "device=0"to target a specific card.