MIT License

项目介绍

gmag11/MetaTrader5-Docker 是一个托管在 GitHub 上的开源项目,主要使用 Shell 编写,采用 MIT License 许可证,目前获得 416 个 Star、182 次 Fork。

仓库全名
gmag11/MetaTrader5-Docker
开源许可证
MIT License
Star 数
416
Fork 数
182
未关闭 Issue
9

README 摘要

MetaTrader5 Docker Image This project provides a Docker image for running MetaTrader5 with remote access via VNC, based on the KasmVNC project and KasmVNC Base Image from LinuxServer. Features Run MetaTrader5 in an isolated environment. Remote access to MetaTrader5 interface via an integrated VNC client accessible through a web browser. Built on the reliable and secure KasmVNC project. RPyC server for remote access…

完整内容见 GitHub 原始 README 或本页 。

常见问题

MetaTrader5-Docker 用什么语言开发?

主要使用 Shell 编写,采用 MIT License 许可证,目前有 416 个 Star。

MetaTrader5-Docker 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 MetaTrader5-Docker 的源码?

可以直接克隆仓库:git clone https://github.com/gmag11/MetaTrader5-Docker.git,默认分支为 main;安装与运行步骤见仓库 README。

MetaTrader5-Docker 最近还在维护吗?

仓库最近一次更新为 2025年12月21日,当前有 9 个未关闭 Issue;Star 数为 416,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Docker image that runs Metatrader 5 with VNC web server

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
796
价值分
305
活跃状态
活跃

语言占比

Dockerfile
Shell

Release

README

MetaTrader5 Docker Image

This project provides a Docker image for running MetaTrader5 with remote access via VNC, based on the KasmVNC project and KasmVNC Base Image from LinuxServer.

Features

  • Run MetaTrader5 in an isolated environment.
  • Remote access to MetaTrader5 interface via an integrated VNC client accessible through a web browser.
  • Built on the reliable and secure KasmVNC project.
  • RPyC server for remote access to Python MetaTrader Library from Windows or Linux using https://github.com/lucas-campagna/mt5linux

MetaTrader5 running inside container and controlled through web browser


NOTICE: Due to some compatibility issued, version 2 has switched its base from Alpine to Debian Linux. This and adding Python environment makes that container size is considerably bigger from about 600 MB to 4 GB.

If you just need to run Metatrader for running your MQL5 programs without any Python programming I recommend to go on using version 1.0. MetaTrader program is updated independently from image so you will always have latest MT5 version.


Requirements

  • Docker installed on your machine.
  • Only intelx86/amd64 host is supported

Usage from repository

  1. Clone this repository:
git clone https://github.com/gmag11/MetaTrader5-Docker-Image
cd MetaTrader5-Docker-Image
  1. Build the Docker image:
docker build -t mt5 .
  1. Run the Docker image:
docker run -d -p 3000:3000 -p 8001:8001 -v config:/config mt5

Now you can access MetaTrader5 via a web browser at localhost:3000.

On first run it may take a few minutes to get everything installed and running. Normally it takes less than 5 minutes. You don’t need to do anything. All installation process is automatic and you should end up with MetaTrader5 running in your web session.

Usage with docker compose with image form Docker Registry (preferred way)

  1. Create a folder in a path where you have permission. For instance in your home.
mkdir MT5
cd MT5
  1. Create docker-compose.yaml file.
nano docker-compose.yaml

Use this content filling user and password with your own data.

version: '3'

services:
  mt5:
    image: gmag11/metatrader5_vnc
    container_name: mt5
    volumes:
      - ./config:/config
    ports:
      - 3000:3000
      - 8001:8001
    environment:
      - CUSTOM_USER=<Choose a user>
      - PASSWORD=<Choose a secure password>

Notice: If you do not need to do remote python programming you can get a much smaller installation changing this line:

image: gmag11/metatrader5_vnc

by this one

image: gmag11/metatrader5_vnc:1.1

Notice: Due to Windows permission management, if you are using windows use Docker managed volume instead of bind mount. Use this compose file instead:

version: '3'
services:
  mt5:
    image: gmag11/metatrader5_vnc
    container_name: mt5
    volumes:
      - mt5_config:/config
    ports:
      - 3000:3000
      - 8001:8001
    environment:
      - CUSTOM_USER=<Choose a user>
      - PASSWORD=<Choose a secure password>

volumes:
  mt5_config:

  1. Start the container
docker compose up -d

In some systems docker compose command does not exists. Try to use docker-compose up -d instead.

  1. Connect to web interface

Start your browser pointing http://<your ip address>:3000

On first run it may take a few minutes to get everything installed and running. Normally it takes less than 5 minutes. You don’t need to do anything. All installation process is automatic and you should end up with MetaTrader5 running in your web session.

Where to place MQ5 and EX5 files

In the case you want to run your own MQL5 bots inside the container you can find MQL5 folder structure in

config/.wine/drive_c/Program Files/MetaTrader 5/MQL5

All files that you place there can be accessed from your MetaTrader container without the need to restart anything.

You can access MetaEditor program clicking in IDE button in MetaTrader5 interface.

Notice: If you will run MQL5 only bots (without Python) you can run perfectly with gmag11/metatrader5_vnc:1.0 image as pointed before. Remember that image version is not stuck to a specific MetaTrader 5 version.

Metatrader will always be updated automatically to latest version as it does when it is nativelly installed in Windows.

Python programming

You need to install mt5linux library in your Python host. It may be in any OS, not only Linux.

This is a simple snippet to run your Python script fron any host

from mt5linux import MetaTrader5
mt5 = MetaTrader5(host='host running docker container',port=8001)
mt5.initialize()
print(mt5.version())

Output should be something like this:

(mt5linux) linux:~/$ python3
Python 3.10.13 (main, Dec 26 2023, 20:21:41) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mt5linux import MetaTrader5
>>> mt5 = MetaTrader5(host='192.168.1.10',port=8001)
>>> mt5.initialize()
True
>>> print(mt5.version())
(500, 4120, '22 Dec 2023')
>>>

Configuration

The port configuration can be adjusted as per the instructions in the KasmVNC repository.

MetaTrader 5 Command Line Options

You can pass command line options to MetaTrader 5 using the MT5_CMD_OPTIONS environment variable. This is useful for custom configurations, tester modes, or other MetaTrader command line parameters.

Example using docker-compose:

version: '3'
services:
  mt5:
    image: gmag11/metatrader5_vnc
    container_name: mt5
    volumes:
      - mt5_config:/config
    ports:
      - 3000:3000
      - 8001:8001
    environment:
      - CUSTOM_USER=<Choose a user>
      - PASSWORD=<Choose a secure password>
      - MT5_CMD_OPTIONS=/config:C:\\customized_for_tester_etc.ini

volumes:
  mt5_config:

Example using docker run:

docker run -d -p 3000:3000 -p 8001:8001 \
  -e MT5_CMD_OPTIONS="/config:C:\\customized_for_tester_etc.ini" \
  -v mt5_config:/config \
  gmag11/metatrader5_vnc

Common MetaTrader 5 command line options:

  • /config:<path> - Use a specific configuration file
  • /login:<account> - Automatically login to specified account

For a complete list of available options, refer to the MetaTrader 5 documentation.

Contributions

Feel free to contribute to this project. All contributions are welcome. Open an issue or create a pull request.

License

This project is licensed under the terms of the MIT license.

The KasmVNC project is licensed under the GNU General Public License v2.0 (GPLv2). You can check the license details of KasmVNC here.

KasmVNC Base Image from LinuxServer is licensed unther the GNU General Public License v3.0 (GPLv3). License is available here

Please ensure to comply with the terms and conditions of the licenses while using or modifying this project.

Acknowledgments

Acknowledgments to the KasmVNC project, KasmVNC Base Image from LinuxServer, mt5linux library and any other project or individual that contributed to the realization of this project.

评论

暂无评论