Overview
switchAILocal provides official Docker images and a Docker Compose setup for easy deployment and production use.Quick Start with Docker Compose
Docker Compose Configuration
The includeddocker-compose.yml provides a complete production-ready setup:
docker-compose.yml
Configuration Options
Configuration Options
Environment Variables:
TZ: Timezone for logs and timestamps (default:UTC)REMOTE_COMMAND_HOST: Host for remote command executionSWITCH_AI_IMAGE: Docker image to use (default:traylinx/switchailocal:latest)
./config.yaml: Main configuration file~/.switchailocal: OAuth tokens and authentication data./logs: Application logs (when file logging is enabled)./plugins: Custom LUA plugins and Cortex Router skills
Building from Source
Build your own Docker image from source:Build Arguments
The Dockerfile supports these build arguments:Dockerfile
Dockerfile Architecture
The official Dockerfile uses a multi-stage build for optimal image size:The image includes Node.js and npm to support the Gemini CLI tool for CLI-based authentication.
Using Pre-built Images
Docker Hub
Pull the latest official image:Version Tags
Available image tags:latest: Most recent stable releasevX.Y.Z: Specific version (e.g.,v1.0.0)dev: Development builds from main branch
Volume Management
Configuration Volume
Mount yourconfig.yaml into the container:
Authentication Data
Persist OAuth tokens and session data:Logs
When file logging is enabled, mount a logs directory:config.yaml
Plugins
Mount custom plugins and skills:Environment Variables
Timezone
Set the container timezone:docker-compose.yml
Remote Command Host
For distributed deployments with remote command execution:docker-compose.yml
Networking
Host Network Access
The Docker Compose configuration includeshost.docker.internal mapping for accessing services on the host machine:
docker-compose.yml
- Ollama running on host:
http://host.docker.internal:11434 - LM Studio on host:
http://host.docker.internal:1234 - Other local services
Custom Networks
For advanced deployments, create a custom network:docker-compose.yml
Health Checks
Add a Docker health check:docker-compose.yml
Resource Limits
Set resource constraints for production:docker-compose.yml
Updating
Troubleshooting
View Logs
Check Container Status
Restart Container
Execute Commands Inside Container
Permission Issues
If you encounter permission errors with mounted volumes:Production Considerations
Security
Security
- Always use TLS in production (
tls.enable: truein config.yaml) - Store API keys securely (use Docker secrets or environment variables)
- Restrict management API access (
remote-management.allow-remote: false) - Use strong
api-keysandsecret-keyvalues
Performance
Performance
- Enable usage statistics for monitoring (
usage-statistics-enabled: true) - Configure appropriate
request-retryvalues - Use
streaming.keepalive-secondsfor long-running connections - Set
logs-max-total-size-mbto prevent disk exhaustion
Monitoring
Monitoring
- Monitor container health with
docker-compose ps - Check logs regularly with
docker-compose logs - Use the Management Dashboard at
http://localhost:18080/management - Set up alerts for provider failures using hooks
Next Steps
Management Dashboard
Configure providers and monitor performance through the web UI
Troubleshooting
Resolve common deployment and runtime issues