How to Deploy Tabby on Docker: Self-Hosted AI Code Completion for Your Dev Team

AI tutorial - IT technology blog
AI tutorial - IT technology blog

Context & Why

Sending proprietary source code to third-party APIs is an immediate red flag for teams under strict SOC 2, HIPAA, or client NDA requirements. While tools like GitHub Copilot boost daily developer output, corporate compliance policies often ban them entirely.

Tabby bridges this gap. It is an open-source, self-hosted AI coding engine that lives completely inside your private network. You can run it on an on-premise workstation with an RTX 3060, a dedicated GPU server, or an isolated AWS EC2 instance (such as a g5.xlarge). Tabby provides official plugins for VS Code, IntelliJ, and Vim, and it indexes your local Git repositories to suggest completions tailored to your internal APIs.

Deploying Tabby via Docker gives you zero data-leak risk and eliminates recurring $19/user monthly seat licenses. In our internal tests across 12 microservices, team members saw completion acceptance rates hovering around 28%—very close to commercial alternatives.

Installation

You will need Docker Engine and Docker Compose installed on your host. CPU inference works for basic testing, but an NVIDIA GPU with at least 8 GB VRAM is essential for production. It keeps inline completion latency under 120ms, making typing feel instant.

1. Check NVIDIA Container Toolkit (For GPU Hosts)

Verify that Docker can communicate directly with your graphics card:

nvidia-smi
docker run --rm --gpus all nvidia/cuda:12.2.0-base-ubuntu22.04 nvidia-smi

If the output lists your GPU model and driver version, the container runtime is ready.

2. Create Project Directory

Set up a clean folder structure to persist model weights and indexed repository data:

mkdir -p ~/tabby-server/data && cd ~/tabby-server

3. Create docker-compose.yml

Create a docker-compose.yml file in this directory. The configuration below uses Qwen2.5-Coder-1.5B for inline completion (~3 GB VRAM) and Qwen2.5-Coder-7B for the chat sidebar (~6 GB VRAM on FP16/INT8):

services:
  tabby:
    image: tabml/tabby:latest
    container_name: tabby-server
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      - ./data:/data
    environment:
      - TABBY_DISABLE_USAGE_COLLECTION=1
    command: serve --model TabbyML/Qwen2.5-Coder-1.5B --chat-model TabbyML/Qwen2.5-Coder-7B --device cuda
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

Testing on a machine without a dedicated GPU? Fall back to a lightweight CPU profile:

services:
  tabby:
    image: tabml/tabby:latest
    container_name: tabby-server-cpu
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      - ./data:/data
    command: serve --model TabbyML/StarCoder-1B --device cpu

4. Start the Server

Launch the container in the background:

docker compose up -d

On initial boot, Tabby downloads ~4.5 GB of model weights directly into ./data. On a 100 Mbps connection, expect this step to take roughly 5 to 7 minutes before the port opens.

Configuration

1. Complete the Initial Admin Setup

Open your browser and visit:

http://<your-server-ip>:8080

Create your primary admin account on the first screen. This web console manages team access tokens, repository sync jobs, and prompt configurations.

2. Generate Team Access Tokens

Never hand out admin credentials to developers. Instead, issue dedicated client tokens:

  1. Log into the Tabby Web UI.
  2. Go to Settings > Access Tokens.
  3. Click Generate Token, name it after your team or engineer, and copy the string.

3. Connect Git Repositories for Context Indexing

Tabby uses Tantivy-based code indexing so its completions understand your internal libraries and utility functions:

  1. Head to Repositories in the admin panel.
  2. Add your internal Git URLs (HTTPS or SSH). For private GitLab or GitHub repos, supply a read-only deploy token.
  3. Click Sync. Tabby parses your ASTs and builds a semantic index in the background without blocking completions.

4. Configure Developer IDEs (VS Code Example)

Developers can wire up their editors in under two minutes:

  1. Install the Tabby extension from the VS Code Marketplace.
  2. Open Settings (Ctrl+, or Cmd+,) and search for Tabby.
  3. Set Endpoint to http://<your-server-ip>:8080 (or your internal domain behind an HTTPS reverse proxy).
  4. Paste the developer token into the Token field.

Verification & Monitoring

1. Verify Autocompletion in the Editor

Open a new file (e.g. metrics.py or auth.ts) and write a function header:

def calculate_rolling_retention(user_events: list[dict], cohort_days: int = 30) -> float:
    """Calculate cohort retention rate across the specified window."""

Grey ghost text should appear inline within 80–150ms. Hit Tab to accept the suggestion.

2. Check Server Logs

Make sure requests reach the backend and inference executes cleanly:

docker logs -f tabby-server

A healthy server prints HTTP 200 OK entries on /v1/completions with latency benchmarks for each prompt.

3. Monitor Resource Usage

Track hardware saturation as more team members come online:

# Inspect GPU VRAM allocation and power draw
watch -n 2 nvidia-smi

# Inspect container CPU and RAM usage
docker stats tabby-server

4. Troubleshooting Common Issues

  • High latency on the very first prompt: The engine is initializing KV caches in GPU memory. Second and subsequent requests drop down to normal speeds immediately.
  • CUDA Out of Memory (OOM): If multiple users send concurrent chat requests, VRAM may spike. Fix this by dropping the chat model or switching the completion model to Qwen2.5-Coder-0.5B.
  • Connection Refused errors: Check your host firewall with sudo ufw allow 8080/tcp, or route traffic through Nginx/Caddy to handle TLS termination cleanly.
Share: