Docker deployment reference
This page lists every field and option. The overview shows what it does and a first example.
kdeps bundle build packages your workflow into a Docker image that starts an API server when run. No Dockerfile needed - kdeps generates one from your workflow.yaml.
Overview
# Package workflow into .kdeps file
kdeps bundle package workflow.yaml
# Build Docker image
kdeps bundle build myagent-1.0.0.kdeps --tag myregistry/myagent:latest
# Or with GPU support
kdeps bundle build myagent-1.0.0.kdeps --gpu cuda --tag myregistry/myagent:latest-gpuPackaging
The package command creates a .kdeps archive containing your workflow and resources:
kdeps bundle package path/to/workflow.yamlThis creates myagent-1.0.0.kdeps (name and version from workflow metadata).
What is included
myagent-1.0.0.kdeps
├── workflow.yaml # workflow entry point
├── resources/ # all resource YAML files
├── data/ # data files and scripts
├── requirements.txt # Python dependencies (if present)
└── public/ # static files (if present)Building Docker images
Basic build
kdeps bundle build myagent-1.0.0.kdepsCreates image: kdeps-myagent:1.0.0
Custom tag
kdeps bundle build myagent-1.0.0.kdeps --tag myregistry/myagent:latestShow dockerfile
To see the generated Dockerfile with no build:
kdeps bundle build myagent-1.0.0.kdeps --show-dockerfileGPU support
Build images with GPU acceleration:
# NVIDIA CUDA
kdeps bundle build myagent-1.0.0.kdeps --gpu cuda
# AMD ROCm
kdeps bundle build myagent-1.0.0.kdeps --gpu rocm
# Intel oneAPI
kdeps bundle build myagent-1.0.0.kdeps --gpu intel
# Vulkan (cross-platform)
kdeps bundle build myagent-1.0.0.kdeps --gpu vulkanGPU runtime
When you run GPU-enabled images:
# NVIDIA
docker run --gpus all myregistry/myagent:latest
# AMD
docker run --device=/dev/kfd --device=/dev/dri myregistry/myagent:latestBase OS auto-selection
kdeps automatically selects the base OS based on GPU requirements:
- No
--gpuflag -> Alpine (CPU-only, smallest images ~300MB) --gpuspecified -> Ubuntu (GPU support, glibc-based)
kdeps selects the OS automatically, for compatibility:
# CPU-only: Uses Alpine (smallest)
kdeps bundle build myagent-1.0.0.kdeps
# GPU: Uses Ubuntu (required for GPU drivers)
kdeps bundle build myagent-1.0.0.kdeps --gpu cudaWhy auto-selection?
- Alpine uses musl libc and cannot run GPU workloads (NVIDIA CUDA, AMD ROCm require glibc)
- Ubuntu uses glibc and supports all GPU types
- Auto-selection prevents invalid combinations (e.g., Alpine + CUDA)
| Configuration | Base OS | Image Size | Use Case |
|---|---|---|---|
kdeps bundle build . | Alpine | ~300MB | CPU-only, edge deployment |
kdeps bundle build . --gpu cuda | Ubuntu | ~800MB+ | NVIDIA GPU inference |
kdeps bundle build . --gpu rocm | Ubuntu | ~800MB+ | AMD GPU inference |
kdeps bundle build . --gpu intel | Ubuntu | ~600MB+ | Intel GPU inference |
kdeps bundle build . --gpu vulkan | Ubuntu | ~600MB+ | Cross-platform GPU |
Override the auto-selected distro in workflow.yaml:
deploy:
runtime:
baseOS: ubuntu # alpine (default) or ubuntu--gpu always forces Ubuntu. debian is not supported.
LLM backend in images
By default, kdeps installs no LLM server. Chat resources run on the file backend. At build time, kdeps downloads the llamafile model for each chat resource into the image (/app/.kdeps/models/). The container is a standard alpine:latest or ubuntu:latest base with kdeps and the models. The llamafile serves itself in the container. You do not manage an extra process.
default (file backend) -> FROM alpine:latest or ubuntu:latest
+ pre-baked llamafile per chat model (~1.1 GB for llama3.2:1b)
no chat resources -> FROM alpine:latest or ubuntu:latest (vanilla)Ollama Docker images (opt-in)
kdeps adds Ollama only in these conditions: installOllama: true, KDEPS_DEFAULT_BACKEND=ollama with chat resources, or KDEPS_LLM_ROUTER routes to Ollama.
needs Ollama + alpine CPU -> FROM alpine/ollama:<tag> (~70MB third-party CPU image)
needs Ollama + ubuntu CPU -> FROM ollama/ollama:<tag> (official image)
needs Ollama + --gpu cuda -> FROM ollama/ollama:<tag> (runtime: docker run --gpus all)
needs Ollama + --gpu rocm -> FROM ollama/ollama:rocm (runtime: --device /dev/kfd --device /dev/dri)
no Ollama -> FROM alpine:latest or ubuntu:latest| Image | Size | GPU | Source |
|---|---|---|---|
alpine/ollama | ~70MB | CPU only | alpine-docker/ollama |
ollama/ollama | ~4GB | CPU + NVIDIA | Official Ollama Docker |
ollama/ollama:rocm | varies | AMD | Official :rocm variant |
When the base image already includes Ollama, kdeps does not COPY --from a second Ollama layer.
Offline mode
Bake models into the image for air-gapped deployments:
# workflow.yaml
deploy:
runtime:
offlineMode: true
models:
- llama3.2:1b
- llama3.2-visionBuild with models included:
kdeps bundle build myagent-1.0.0.kdepsThe resulting image contains all models and does not require internet access.
Python dependencies
Using requirements.txt
# workflow.yaml
deploy:
runtime:
requirementsFile: "requirements.txt"kdeps uses uv for fast Python package management (97% smaller than Anaconda).
Inline packages
# workflow.yaml
deploy:
runtime:
pythonVersion: "3.12"
pythonPackages:
- pandas>=2.0
- numpy
- scikit-learnSystem packages
Install OS-level packages:
# workflow.yaml
deploy:
runtime:
osPackages:
- ffmpeg
- imagemagick
- tesseract-ocr
- poppler-utils
repositories:
- ppa:alex-p/tesseract-ocr-develPackage version pinning
On every bundle build, kdeps resolves package versions before it generates the Dockerfile:
- kdeps - latest GitHub release. kdeps gets
install.shfrom that tag and gives the same tag to the installer (nevermain+ floating latest) - ollama - latest ollama/ollama release as the Docker image tag for
ollama/ollamaandalpine/ollama(never:latest).--gpu rocmuses the fixedollama/ollama:rocmtag instead. - uv - latest astral-sh/uv release as the
ghcr.io/astral-sh/uvtag
Override any field with an explicit semver (v1.2.3 or 1.2.3). Use latest or omit a field to accept the resolved value at build time.
# workflow.yaml
deploy:
runtime:
versions:
kdeps: v3.0.0 # optional - default: newest GitHub release when bundle build runs
ollama: 0.5.4 # optional - default: newest ollama/ollama release
uv: 0.6.3 # optional - default: newest astral-sh/uv releasePreview resolved pins:
kdeps bundle build myagent-1.0.0.kdeps --show-dockerfileIf you do not select an Ollama base image, kdeps uses alpine:latest or ubuntu:latest. If you do not set pythonVersion, Python is 3.12.
Environment variables
Build-time args
# workflow.yaml
deploy:
runtime:
args:
BUILD_VERSION: ""Pass during build:
docker build --build-arg BUILD_VERSION=1.0.0 ...Runtime environment
# workflow.yaml
deploy:
runtime:
env:
LOG_LEVEL: "info"
API_TIMEOUT: "30"Override at runtime:
docker run -e LOG_LEVEL=debug myregistry/myagent:latestDocker compose
kdeps generates a docker-compose.yml:
# docker-compose.yml
version: '3.8'
services:
myagent:
image: kdeps-myagent:1.0.0
ports:
- "16395:16395" # API server
- "16395:16395" # Web server (if enabled)
environment:
- LOG_LEVEL=info
volumes:
- ollama:/root/.ollama
- kdeps_data:/agent/volume
restart: on-failure
# For GPU:
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]
volumes:
ollama:
kdeps_data:Run with:
docker-compose up -dOptimized build process
kdeps uses a simple build process with the official installation script. This gives the smallest possible image and the best compatibility.
kdeps renders the Dockerfile, entrypoint, and supervisord configuration from the docker/image asset (kdeps upgrade docker refreshes them; kdeps build --show-dockerfile prints the result). kdeps export k8s renders the k8s/manifests asset the same way.
# Example of generated Dockerfile logic
FROM alpine:3.18
# Upgrade base packages (security patches), then install dependencies
RUN apk upgrade --no-cache && \
apk add --no-cache curl bash python3 py3-pip
# Install kdeps via official install script. Released CLIs pin both the
# script ref and the binary tag to their own version; dev builds use main.
RUN curl -LsSf https://raw.githubusercontent.com/kdeps/kdeps/v3.0.0/install.sh | sh -s -- -b /usr/local/bin v3.0.0
# kdeps assets (harness, tool definitions, model registries, ...) from the
# machine running kdeps build: the binary ships none, so the container needs
# no download at start
ENV KDEPS_ASSETS_DIR=/app/.kdeps/assets
COPY kdeps-assets/ /app/.kdeps/assets/
# Copy agent files
COPY workflow.yaml /app/workflow.yaml
COPY resources/ /app/resources/
WORKDIR /app
ENTRYPOINT ["kdeps"]
CMD ["run", "workflow.yaml"]The build process also automatically handles:
- Python environments: Integrated
uvfor 97% smaller virtual environments. - Model management: Pre-pulling models for offline readiness.
- Service orchestration: Lightweight
supervisorto manage API and LLM processes.
Health checks
Add a health endpoint:
# workflow.yaml
deploy:
apiServer:
routes:
- path: /health
methods: [GET]In Docker Compose:
# docker-compose.yml
services:
myagent:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:16395/health"]
interval: 30s
timeout: 10s
retries: 3Kubernetes deployment
kdeps generates Kubernetes manifests directly from your workflow.yaml using kdeps export k8s. No manual YAML authoring needed.
# Build and push the Docker image first
kdeps bundle build . --tag myregistry/myagent:1.0.0
docker push myregistry/myagent:1.0.0
# Generate manifests
kdeps export k8s . \
--image myregistry/myagent:1.0.0 \
--output k8s.yaml
# Apply to cluster
kubectl apply -f k8s.yamlConfigure Kubernetes settings in workflow.yaml:
# workflow.yaml
deploy:
apiServer:
portNum: 16395
runtime:
replicas: 3
resources:
cpuLimit: "2000m"
memoryLimit: "4Gi"
cpuRequest: "500m"
memoryRequest: "1Gi"
env:
LOG_LEVEL: infoThe generated manifest includes a Deployment with readiness/liveness probes and a ClusterIP Service, both derived from your workflow settings.
See the Kubernetes deployment guide for the full reference.
LLM server appliance (not an agent image)
This page packages agents (workflow.yaml + kdeps). For a standalone OpenAI-compatible model server:
kdeps llm build --engine ollama --model llama3.2 --tag myorg/llm:1
kdeps llm build --engine vllm --model facebook/opt-125m --gpu cuda --tag myorg/vllm:1See LLM server appliance.
HTTPS / custom domain
For automatic Let's Encrypt certificates on a custom domain, add letsEncrypt: under settings: in the workflow and publish ports 80 and 443. Persist the certificate cache:
docker run -p 80:80 -p 443:443 \
-v kdeps-le:/var/lib/kdeps/letsencrypt \
myagent:latestdeploy:
letsEncrypt:
domain: api.example.com # cert hostname; its A/AAAA record must point here
email: ops@example.com # Let's Encrypt registration email
cacheDir: /var/lib/kdeps/letsencrypt # ACME keys + certs; persist it so renewals survive restarts
apiServer:
hostIp: "0.0.0.0" # listen on every interface
portNum: 443 # HTTPS + TLS-ALPN-01; also open port 80 for HTTP-01See TLS and HTTPS (custom domains). kdeps also supports static PEM mounts with certFile/keyFile.
See also
- Docker reference - production best practices, security hardening, troubleshooting
- Workflow configuration - agent settings
- Web server mode - serve frontends
- LLM backends - backend configuration
- Management API - live workflow updates with no rebuild
