Skip to main content

Docker Deployment

Deploy Plugged.in using Docker for consistent, scalable, and portable deployments across any environment.

Quick Start

1

Clone Repository

2

Configure Environment

3

Build and Run

4

Access Application

Production Multi-Instance Deployments: If you’re deploying multiple application instances (horizontal scaling), Redis is REQUIRED for distributed rate limiting. See the Multi-Instance Deployment Guide for complete setup instructions.

Multi-Architecture Support

NEW: Plugged.in now supports both AMD64 and ARM64 architectures!Our Docker images are now available as multi-architecture builds on Docker Hub, automatically selecting the correct platform for your system.

AMD64 (x86_64)

✅ Intel/AMD processors ✅ Most cloud platforms ✅ Traditional servers

ARM64 (aarch64)

✅ Apple Silicon (M1/M2/M3) ✅ AWS Graviton ✅ Raspberry Pi 4+

Verify Platform Support

Check available architectures for any version:
Docker automatically pulls the correct architecture for your platform. No manual configuration needed!

Docker Hub Deployment

Using Pre-built Image

1

Pull Image

2

Run with Docker Compose

Publishing Multi-Arch Images to Docker Hub

Use the provided docker-build.sh script for automated multi-architecture builds and publishing.
1

Build Multi-Arch Image

What this does:
  • Sets up Docker buildx for multi-platform builds
  • Builds for both linux/amd64 and linux/arm64
  • Creates unified manifest
  • Pushes to Docker Hub
  • Tags both version and latest
2

Manual Multi-Arch Build (Advanced)

3

Verify Multi-Arch Upload

For multi-arch builds, you need Docker Desktop or Docker with buildx support. The automated script (docker-build.sh) handles all setup automatically.

Docker Architecture

Application Container

  • Next.js 15 application
  • Node.js 20 runtime
  • MCP proxy server
  • Port 12005 exposed

Database Container

  • PostgreSQL 18-alpine
  • Persistent volume
  • Health checks enabled
  • Port 5432 exposed

Redis Container

  • Redis 7-alpine
  • Distributed rate limiting
  • AOF persistence enabled
  • Port 6379 exposed

Migrator Container

  • One-time migration runner
  • Optimized size (288 MB)
  • Auto-stops after migrations
  • Drizzle ORM migrations

Persistent Volumes

  • Database data
  • Redis data (AOF)
  • User uploads
  • Application logs
  • MCP package cache

What’s Included

  • ✅ PostgreSQL 18 (latest stable) with automatic migrations
  • ✅ Redis 7 for distributed rate limiting and caching
  • ✅ Next.js 15 web application with optimized production build
  • ✅ Persistent volumes for database, Redis, uploads, logs, and MCP packages
  • ✅ Health checks and automatic restarts
  • ✅ Migrator container (288 MB) for database setup
  • ✅ Docker-optimized MCP isolation (no sandboxing overhead)
  • ✅ OAuth 2.1 support with proper redirect configuration

Production Dockerfile

The project includes two Dockerfiles:
  1. Dockerfile - Standard build with sandboxing support
  2. Dockerfile.production - Optimized production build
Both include sandboxing tools (bubblewrap, firejail, fuse3) for secure MCP server execution.

Standard Dockerfile Features

Docker Compose Configuration

Development Setup

Production Setup

Environment Variables

Create .env file for Docker deployment:
Redis and Edge Runtime BehaviorThe rate limiter automatically detects the runtime environment:
  • Node.js Runtime (API routes, server actions): Uses Redis with ioredis for distributed rate limiting
  • Edge Runtime (middleware, edge functions): Falls back to in-memory rate limiting as ioredis requires Node.js APIs
This is normal behavior and not an error. You may see logs like:
For production multi-instance deployments, ensure REDIS_URL is configured to enable distributed rate limiting for Node.js runtime routes.

Building and Running

Build Image

Run Containers

Database Management

Migrations

Backup and Restore

Upgrading PostgreSQL

PostgreSQL major version upgrades require data migration. Always backup before upgrading.

Upgrading from PostgreSQL 16 or earlier to 18

Note: This will DELETE all existing data. Only use for development.

Verify PostgreSQL Version

Nginx Configuration

Create nginx.conf for production:

Health Monitoring

Health Check Endpoint

The application provides a health check endpoint:

Docker Health Check

Scaling Strategies

Horizontal Scaling

Load Balancing

Use Docker Swarm or Kubernetes for advanced load balancing:

Troubleshooting

Common Issues

Check logs:
Verify environment variables and database connection
Verify database is running:
Check connection string in .env file
Fix ownership:
Increase memory limits:

Debug Mode

Enable debug logging:

Container Access

Security Best Practices

Never use default passwords in production. Always use secrets management.

1. Use Docker Secrets

2. Non-root User

Always run containers as non-root:

3. Read-only Root Filesystem

4. Network Isolation

Backup Strategy

Automated backup script:
Add to crontab:

Support

For Docker deployment help: