Skip to main content

Overview

switchAILocal provides official Docker images and a Docker Compose setup for easy deployment and production use.

Quick Start with Docker Compose

1

Clone Repository

2

Create Configuration

Edit config.yaml to add your provider credentials and settings.
3

Start with Docker Compose

Or use the hub script:
4

Verify Deployment


Docker Compose Configuration

The included docker-compose.yml provides a complete production-ready setup:
docker-compose.yml
Environment Variables:
  • TZ: Timezone for logs and timestamps (default: UTC)
  • REMOTE_COMMAND_HOST: Host for remote command execution
  • SWITCH_AI_IMAGE: Docker image to use (default: traylinx/switchailocal:latest)
Volumes:
  • ./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:
1

Build with Docker Compose

Or with version metadata:
2

Run Custom Build

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:
Run directly:

Version Tags

Available image tags:
  • latest: Most recent stable release
  • vX.Y.Z: Specific version (e.g., v1.0.0)
  • dev: Development builds from main branch

Volume Management

Configuration Volume

Mount your config.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 includes host.docker.internal mapping for accessing services on the host machine:
docker-compose.yml
This allows the container to connect to:
  • 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

1

Pull Latest Image

2

Restart Services

3

Verify Update


Troubleshooting

View Logs

Check Container Status

Restart Container

Execute Commands Inside Container

Permission Issues

If you encounter permission errors with mounted volumes:

Production Considerations

  • Always use TLS in production (tls.enable: true in config.yaml)
  • Store API keys securely (use Docker secrets or environment variables)
  • Restrict management API access (remote-management.allow-remote: false)
  • Use strong api-keys and secret-key values
  • Enable usage statistics for monitoring (usage-statistics-enabled: true)
  • Configure appropriate request-retry values
  • Use streaming.keepalive-seconds for long-running connections
  • Set logs-max-total-size-mb to prevent disk exhaustion
  • 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