MetaTrader Docker Deployment
Deploy MT4/MT5 to cloud in one command — noVNC remote access, Cloudflare tunnel auth, Wine-powered, production-ready.
Every document in docs/ is listed with the question it answers in docs/PAGE-INDEX.md .
---
Component
Technology
MT4/MT5
Windows apps via Wine 9+
Remote UI
noVNC (browser-based VNC)
Auth
Cloudflare Tunnel + Access (Zero Trust)
Orchestration
Docker Compose, systemd-ready
Persistence
Named volumes for config/terminals
Use case: Run EAs 24/7 on cheap VPS, access from any browser, zero Windows license.
# Clone
git clone https://github.com/ishan-parihar/metatrader-docker-deployment
cd metatrader-docker-deployment/MT5
# Configure
cp .env.example .env
# Edit .env: CLOUDFLARE_TUNNEL_TOKEN, VNC_PASSWORD, MT_VERSION=5
# Deploy
docker compose up -d
# Access: https://mt5.yourdomain.com (Cloudflare Access protected)
Feature
Details
MT4 & MT5
Switch via MT_VERSION env
Multi-terminal
Run multiple accounts in one container
EA support
Copy .ex4/.ex5 to experts/ volume
Cloudflare Access
Email, GitHub, Google, OTP auth
Auto-restart
restart: unless-stopped + healthcheck
Backup
docker compose exec mt5 backup
# .env
CLOUDFLARE_TUNNEL_TOKEN=xxx
VNC_PASSWORD=secure_password
MT_VERSION=5 # or 4
MT_LOGIN=12345678 # optional: auto-login
MT_PASSWORD=****** # optional
MT_SERVER=MetaQuotes-Demo # optional
TIMEZONE=UTC
Command
Description
docker compose up -d
Deploy
docker compose logs -f
View logs
docker compose exec mt5 backup
Backup terminals
docker compose exec mt5 restore
Restore backup
docker compose down
Stop
noVNC MT5
Architecture
Deploy output
Cloudflare auth
Multi-terminal
Backup/restore
┌─────────────────────────────────────────────────────────────┐
│ Internet │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Cloudflare Tunnel (Zero Trust) │
│ HTTPS + Auth (email/SSO/OTP) │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Docker Host │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Container: metatrader │ │
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
│ │ │ Wine │─▶│ MT5 │ │ Xvfb │ │ │
│ │ │ (Win10)│ │ terminal│ │ :99 │ │ │
│ │ └─────────┘ └─────────┘ └────┬────┘ │ │
│ │ │ │ │
│ │ ┌─────────┐ ┌─────────┐ │ │ │
│ │ │ x11vnc │──▶│ noVNC │──────┘ │ │
│ │ │ :5900 │ │ :6080 │ │ │
│ │ └─────────┘ └─────────┘ │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Docker 24+ / Docker Compose 2+ - Cloudflare account (free tier works) - Domain (or use Cloudflare Pages subdomain) - 2 GB RAM minimum (4 GB recommended)
Linux host (x86_64) ---
MIT. The full text is in LICENSE.