One of the most common questions on the NVIDIA Developer Forums is: Should you use Docker Compose or Kubernetes to run NIM microservices on your DGX Spark? This guide cuts through the confusion and gives you practical steps for both setups so you can decide which fits your workload. Why This Decision Matters The NVIDIA […]
Collabnix Team Follow The Collabnix Team is a diverse collective of Docker, Kubernetes, and IoT experts united by a passion for cloud-native technologies. With backgrounds spanning across DevOps, platform engineering, cloud architecture, and container orchestration, our contributors bring together decades of combined experience from various industries and technical domains.
21st June 2026 1 min read
One of the most common questions on the NVIDIA Developer Forums is: Should you use Docker Compose or Kubernetes to run NIM microservices on your DGX Spark? This guide cuts through the confusion and gives you practical steps for both setups so you can decide which fits your workload.
Why This Decision MattersThe NVIDIA DGX Spark (GB10 Grace Blackwell Superchip, 128GB unified memory) is a powerful personal AI supercomputer. Choosing the wrong orchestration layer can waste GPU cycles or complicate your deployment. Here is a practical breakdown.
Option 1: Docker Compose SetupBest for: Single DGX Spark node, quick prototyping, dev/test workflows.
Step 1: Install NVIDIA Container Toolkitcurl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
Step 2: Authenticate with NGC
docker login nvcr.io
# Username: $oauthtoken
# Password: YOUR_NGC_API_KEY
Step 3: Create docker-compose.yml for NIM
version: "3.8"
services:
nim-llm:
image: nvcr.io/nim/meta/llama-3.1-8b-instruct:latest
runtime: nvidia
environment:
- NIM_HTTP_API_PORT=8000
ports:
- "8000:8000"
volumes:
- ./models:/opt/nim/.cache
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
Step 4: Launch the NIM service
export NGC_API_KEY=nvapi-xxxxxxxxxxxx
docker compose up -d
Step 5: Test the endpoint
curl -X POST http://localhost:8000/v1/completions -H "Content-Type: application/json" -d '{"model": "meta/llama-3.1-8b-instruct", "prompt": "What is DGX Spark?", "max_tokens": 100}'
Option 2: Kubernetes Setup (K3s)
Best for: Multi-node DGX Spark clusters, production workloads, GPU scheduling across nodes.
Step 1: Configure NVIDIA runtime as defaultsudo nvidia-ctk runtime configure --runtime=docker --set-as-default
sudo systemctl restart docker
Step 2: Install K3s with Docker runtime
curl -sfL https://get.k3s.io | sh -s - --docker --write-kubeconfig-mode 644
Step 3: Install NVIDIA GPU Operator
helm repo add nvidia https://helm.ngc.nvidia.com/nvidia
helm repo update
helm install gpu-operator nvidia/gpu-operator --namespace gpu-operator --create-namespace --set driver.enabled=false --set toolkit.enabled=false
Step 4: Create NGC pull secret
kubectl create secret docker-registry ngc-secret --docker-server=nvcr.io --docker-username='$oauthtoken' --docker-password=YOUR_NGC_API_KEY
Step 5: Deploy NIM as a Kubernetes Deployment
cat <<'EOF' | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: nim-llm
spec:
replicas: 1
selector:
matchLabels:
app: nim-llm
template:
metadata:
labels:
app: nim-llm
spec:
imagePullSecrets:
- name: ngc-secret
containers:
- name: nim-llm
image: nvcr.io/nim/meta/llama-3.1-8b-instruct:latest
env:
- name: NGC_API_KEY
value: "YOUR_NGC_API_KEY"
ports:
- containerPort: 8000
resources:
limits:
nvidia.com/gpu: 1
EOF
Step 6: Expose the service and test
kubectl expose deployment nim-llm --type=NodePort --port=8000
kubectl get svc nim-llm
Quick Comparison
| Feature | Docker Compose | Kubernetes (K3s) |
|---|---|---|
| Setup time | ~10 minutes | ~30 minutes |
| Multi-node support | No | Yes |
| GPU scheduling | Basic | Advanced |
| Best for | Single Spark, dev | 2+ Spark nodes, prod |
If you have a single DGX Spark and want to get NIM running fast, Docker Compose wins. If you have two or more Sparks and need production-grade scheduling, go with K3s or full Kubernetes. The GPU performance of NIM containers is identical in both — the difference is only in orchestration overhead.
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Deploying NVIDIA NIM Containers on DGX Spark with Minikube: A Complete Guide for AI Researchers | 0 | 7.18 | 21-06-2026 |
| 2 | How to Connect Two NVIDIA DGX Spark Nodes as Kubernetes GPU Workers for Distributed AI Inference | 0 | 6.3 | 21-06-2026 |
| 3 | Setting Up a K3s Kubernetes Cluster on NVIDIA DGX Spark with Full GPU Support | 0 | 8.34 | 21-06-2026 |
| 4 | Running GPU Workloads on Kubernetes with NVIDIA: A Comprehensive Guide | 0 | 9.6 | 21-09-2026 |
| 5 | How to Run GPU Workloads on Kubernetes with NVIDIA: A Step-by-Step Guide | 0 | 10.06 | 26-06-2026 |
| 6 | Running vLLM on NVIDIA DGX Spark with Docker: Zero-Compilation Guide for CUDA 13 | 0 | 8.69 | 21-06-2026 |
| 7 | From Docker Compose to Kubernetes: A Practical Guide to the Errors Everyone Hits | 0 | 11.61 | 08-08-2026 |
| 8 | How GPU Allocation Works in Kubernetes: A Simple Explainer | 0 | 10.79 | 05-07-2026 |
| 9 | Kubeflow vs Argo Workflows: Choosing the Best ML Pipeline Tool for Kubernetes | 0 | 5.29 | 15-07-2026 |