Dockerfile walkthrough
The repository Dockerfile uses a two-stage build: a full Go toolchain for compilation, then a stripped Alpine image for the runtime.Dockerfile
Builder stage
Runtime stage
Build variants
WebRTC + Opus Dockerfile
To enable Opus you need CGO, which means a C compiler in the builder stage and musl-compatible shared libs in the runtime image (or static linking via musl-cross).Dockerfile.webrtc
Building the default image
golang:1.25-alpine on first run, compile the binary, and assemble the runtime layer. Subsequent builds reuse the module cache layer unless go.mod or go.sum changed.
Running the container
Basic run
Mount yourconfig.json from the host. The file is mounted read-only (:ro) so the container cannot modify it.
With environment variable overrides
Allconfig.json fields can be overridden at runtime via environment variables. Provider API keys should always be passed as env vars rather than embedded in the config file.
Detached with automatic restart
Port configuration
The default port is8080, set via EXPOSE 8080 in the Dockerfile and the default config. Override it in order of precedence:
VOXRAY_PORTenvironment variablePORTenvironment variableportfield inconfig.json
-p flag:
Health check
Add aHEALTHCHECK instruction to your Dockerfile (or pass it at docker run) so Docker can restart unhealthy containers automatically.
Use
/health for Docker’s HEALTHCHECK. Use /ready for load balancer health checks and Kubernetes readiness probes so traffic is not routed to an instance whose session store is not yet reachable.
Useful environment variables
The table below covers variables most relevant to containerized deployments. See Deployment for the full reference.Image size
The final image is approximately 20–25 MB (uncompressed): ~5 MB for Alpine base, ~15 MB for the stripped Voxray binary. No Go runtime, no build tools, no shell utilities beyond what Alpine includes by default.The
voxray user created in the Dockerfile has no home directory write permissions outside /app. If your config references file paths for TLS certificates or recording temp files, ensure those paths are writable by UID voxray or mount them as volumes.Next steps
- Docker Compose — multi-service local setup with optional Redis
- Deployment overview — environment variables, TLS, and security checklist