> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentfront.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Docker Deployment

> Deploy VectoriaDB with Docker

Learn how to deploy VectoriaDB in Docker containers.

## Dockerfile

```dockerfile title="Dockerfile" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
FROM node:22-slim

WORKDIR /app

# Install dependencies
COPY package*.json ./
RUN npm ci --only=production

# Copy application code
COPY . .

# Create cache directories
RUN mkdir -p .cache/transformers .cache/vectoriadb

# Pre-download embedding model (optional but recommended)
RUN node -e "require('@huggingface/transformers').pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2')"

# Set environment variables
ENV NODE_ENV=production
ENV VECTORIA_CACHE_DIR=./.cache/vectoriadb
ENV VECTORIA_MODEL_CACHE=./.cache/transformers

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s \
  CMD curl -f http://localhost:3000/health || exit 1

EXPOSE 3000

CMD ["node", "dist/server.js"]
```

## docker-compose.yml

```yaml title="docker-compose.yml" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
version: '3.8'

services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - VECTORIA_USE_HNSW=true
      - VECTORIA_MAX_DOCS=100000
      - REDIS_URL=redis://redis:6379
    volumes:
      - vectoria-cache:/app/.cache
    depends_on:
      - redis
    deploy:
      resources:
        limits:
          memory: 2G
        reservations:
          memory: 1G

  redis:
    image: redis:7-alpine
    volumes:
      - redis-data:/data
    command: redis-server --appendonly yes

volumes:
  vectoria-cache:
  redis-data:
```

## Multi-Stage Build

For smaller images:

```dockerfile title="Dockerfile.multistage" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
# Build stage
FROM node:22-slim AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# Production stage
FROM node:22-slim
WORKDIR /app

# Copy built assets
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./

# Create cache directories
RUN mkdir -p .cache/transformers .cache/vectoriadb

ENV NODE_ENV=production
EXPOSE 3000
CMD ["node", "dist/server.js"]
```

## Volume Mounts

Mount cache directories for persistence:

```yaml title="docker-compose.yml" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
volumes:
  - ./cache/transformers:/app/.cache/transformers
  - ./cache/vectoriadb:/app/.cache/vectoriadb
```

Or use named volumes:

```yaml title="docker-compose.yml" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
volumes:
  vectoria-cache:

services:
  app:
    volumes:
      - vectoria-cache:/app/.cache
```

## Resource Limits

Set appropriate memory limits:

```yaml title="docker-compose.yml" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
deploy:
  resources:
    limits:
      memory: 2G    # For ~100k documents
    reservations:
      memory: 1G
```

### Memory Guidelines

| Documents | Recommended Memory |
| --------- | ------------------ |
| 10,000    | 512MB              |
| 50,000    | 1GB                |
| 100,000   | 2GB                |
| 500,000   | 8GB                |

## Kubernetes Deployment

```yaml title="k8s/deployment.yaml" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vectoriadb-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: vectoriadb-app
  template:
    metadata:
      labels:
        app: vectoriadb-app
    spec:
      containers:
        - name: app
          image: your-registry/vectoriadb-app:latest
          ports:
            - containerPort: 3000
          env:
            - name: VECTORIA_USE_HNSW
              value: "true"
            - name: REDIS_URL
              valueFrom:
                secretKeyRef:
                  name: redis-secret
                  key: url
          resources:
            limits:
              memory: 2Gi
            requests:
              memory: 1Gi
          livenessProbe:
            httpGet:
              path: /health
              port: 3000
            initialDelaySeconds: 60
            periodSeconds: 30
          readinessProbe:
            httpGet:
              path: /ready
              port: 3000
            initialDelaySeconds: 30
            periodSeconds: 10
```

## Related

<CardGroup cols={3}>
  <Card title="Production Config" icon="gear" href="/vectoriadb/deployment/production-config">
    Configuration options
  </Card>

  <Card title="Environment Variables" icon="list" href="/vectoriadb/deployment/environment-variables">
    Env var reference
  </Card>

  <Card title="Health Monitoring" icon="heart-pulse" href="/vectoriadb/deployment/health-monitoring">
    Monitoring setup
  </Card>
</CardGroup>
