MetaTrader 5 trading platform running in Docker. Access with web browser (vnc) and Python API RPyC.
376
A ready-to-use MetaTrader 5 trading platform running in Docker with remote desktop access through your web browser. No Windows required!
Open your terminal and type:
docker pull YOUR_USERNAME/mt5_client_vnc:latest
Run this command:
docker run -d \
--name my_mt5 \
-p 6080:6901 \
-p 5900:5900 \
-p 8001:8001 \
-v mt5_data:/config \
YOUR_USERNAME/mt5_client_vnc:latest
http://localhost:6080/index.html| Port | What it's for |
|---|---|
| 6080 | Web Browser Access (recommended) |
| 5900 | VNC Client Access (advanced users) |
| 8001 | Python/API Connection |
http://localhost:6080/index.htmllocalhost:5900# Enter the container
docker exec -it my_mt5 bash
# Set a new password
x11vnc -storepasswd your_new_password ~/.vnc/passwd
# Restart the container
docker restart my_mt5
Add these URLs to WebRequest whitelist:
http://localhost:8001http://127.0.0.1:8001pip install MetaTrader5 rpyc
import rpyc
# Connect to MT5 in Docker
connection = rpyc.connect("localhost", 8001)
mt5 = connection.root
# Initialize MT5
if mt5.initialize():
print("Connected to MT5!")
# Get account info
account_info = mt5.account_info()
print(f"Balance: ${account_info.balance}")
# Shutdown
mt5.shutdown()
Your MT5 settings and files are saved in Docker volume mt5_data. To backup:
# Create backup
docker run --rm -v mt5_data:/config -v $(pwd):/backup \
alpine tar czf /backup/mt5_backup.tar.gz -C /config .
# Restore backup
docker run --rm -v mt5_data:/config -v $(pwd):/backup \
alpine tar xzf /backup/mt5_backup.tar.gz -C /config
docker psdocker logs my_mt5Ctrl+F5docker exec my_mt5 ping google.com-p 8001:8001docker exec my_mt5 ps aux | grep mt5linux# Stop MT5
docker stop my_mt5
# Start MT5 again
docker start my_mt5
# Remove container (data is safe in volume)
docker rm my_mt5
# See what's happening
docker logs my_mt5
# Enter container terminal
docker exec -it my_mt5 bash
mt5_data volume weeklyThink of encryption like putting your trading data in a locked box while sending it over the internet. Without it, anyone could peek inside!
When you need encryption:
This is like making your own lock - it works, but browsers will warn you it's "not trusted". That's OK for testing!
# Enter the container
docker exec -it my_mt5 bash
# Make a folder for certificates
mkdir -p /config/ssl
# Create your certificate (just press ENTER for all questions)
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /config/ssl/selfsigned.key \
-out /config/ssl/selfsigned.crt \
-subj "/C=US/ST=State/L=City/O=MyTrading/CN=localhost"
# Exit container
exit
# Stop old container
docker stop my_mt5
docker rm my_mt5
# Start with HTTPS enabled
docker run -d \
--name my_mt5 \
-p 6443:6901 \
-p 5900:5900 \
-p 8443:8001 \
-v mt5_data:/config \
-e SSL_CERT=/config/ssl/selfsigned.crt \
-e SSL_KEY=/config/ssl/selfsigned.key \
crazykoodaa/mt5_client_vnc:latest
https://localhost:6443/index.html (note: https not http)This is like getting a lock from a trusted locksmith - no browser warnings!
mt5.yourdomain.com)# Create a network for our containers
docker network create mt5_network
# Start Nginx Proxy Manager
docker run -d \
--name nginx_proxy \
--network mt5_network \
-p 80:80 \
-p 443:443 \
-p 81:81 \
-v npm_data:/data \
-v npm_letsencrypt:/etc/letsencrypt \
jc21/nginx-proxy-manager:latest
docker run -d \
--name my_mt5 \
--network mt5_network \
-v mt5_data:/config \
crazykoodaa/mt5_client_vnc:latest
http://your-server-ip:81[email protected]changememt5.yourdomain.commy_mt56901Now access MT5 at: https://mt5.yourdomain.com 🎉
import rpyc
import ssl
# Trust our self-signed certificate
config = {"ssl_context": ssl._create_unverified_context()}
# Connect securely
connection = rpyc.connect("localhost", 8443, config=config)
mt5 = connection.root
import rpyc
# Nginx handles SSL, so connect normally
connection = rpyc.connect("mt5.yourdomain.com", 8001)
mt5 = connection.root
With encryption set up:
https://your-computer-ip:6443https://mt5.yourdomain.comF1 in MetaTrader 5Remember: This is just software. Always trade responsibly and never risk money you can't afford to lose! 📊💡
Content type
Image
Digest
sha256:815f7bef9…
Size
1.9 GB
Last updated
over 1 year ago
docker pull crazykoodaa/mt5_client_vnc:working-backup