Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Metatrader/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ WINEDEBUG='-all'
wine_executable="wine"
metatrader_version="5.0.36"
mt5server_port="8001"
MT5_CMD_OPTIONS="${MT5_CMD_OPTIONS:-}"
mono_url="https://dl.winehq.org/wine/wine-mono/10.3.0/wine-mono-10.3.0-x86.msi"
python_url="https://www.python.org/ftp/python/3.9.13/python-3.9.13.exe"
mt5setup_url="https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe"
Expand Down Expand Up @@ -70,7 +71,7 @@ fi
# Recheck if MetaTrader 5 is installed
if [ -e "$mt5file" ]; then
show_message "[4/7] File $mt5file is installed. Running MT5..."
$wine_executable "$mt5file" &
$wine_executable "$mt5file" $MT5_CMD_OPTIONS &

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Mt5 options word-split 🐞 Bug ≡ Correctness

Metatrader/start.sh appends MT5_CMD_OPTIONS unquoted when launching MT5, so bash performs
word-splitting and pathname expansion which can corrupt the intended argument list (especially for
paths containing spaces or wildcards). This can cause MT5 to start without the intended /config or
other parameters, breaking the new feature.
Agent Prompt
## Issue description
`MT5_CMD_OPTIONS` is expanded unquoted when invoking `wine terminal64.exe`, which triggers bash word-splitting and glob expansion.

## Issue Context
`MT5_CMD_OPTIONS` is meant to carry MT5 CLI parameters (README documents `/config:<path>`), and these paths/options can legitimately contain spaces or glob characters. Unquoted expansion can change the arguments passed to MT5.

## Fix Focus Areas
- Metatrader/start.sh[10-10]
- Metatrader/start.sh[74-74]

## Suggested fix
Use an array and a delimiter that preserves spaces inside an option (e.g., newline-separated options), then pass via `"${array[@]}"`.

Example pattern:
```bash
# Accept newline-separated options (spaces preserved)
mt5_opts=()
if [ -n "${MT5_CMD_OPTIONS:-}" ]; then
  IFS=$'\n' read -r -d '' -a mt5_opts < <(printf '%s\0' "$MT5_CMD_OPTIONS")
fi

# Optionally disable globbing around this call
set -f
$wine_executable "$mt5file" "${mt5_opts[@]}" &
set +f
```
Update README to mention newline-separated options if multiple are needed.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n 'MT5_CMD_OPTIONS|wine_executable.*mt5file' Metatrader/start.sh README.md

MT5_CMD_OPTIONS='/config:C:\Program Files\tester.ini /login:123'
printf 'Current expansion:\n'
printf '<%s>\n' $MT5_CMD_OPTIONS

Repository: marlonsc/mt5-docker

Length of output: 741


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Metatrader/start.sh ---'
sed -n '1,95p' Metatrader/start.sh
printf '%s\n' '--- README.md option documentation ---'
sed -n '175,225p' README.md
printf '%s\n' '--- repository references ---'
rg -n --glob '!**/.git/**' 'MT5_CMD_OPTIONS|wine_executable|mt5file' .

Repository: marlonsc/mt5-docker

Length of output: 7236


🏁 Script executed:

#!/bin/bash
set -euo pipefail

bash <<'BASH'
set -u

show_current() {
    local MT5_CMD_OPTIONS=$1
    printf 'current input=%q\n' "$MT5_CMD_OPTIONS"
    printf 'current argv:'
    printf '<%s>' $MT5_CMD_OPTIONS
    printf '\n'
}

show_array() {
    local MT5_CMD_OPTIONS=$1
    local -a mt5_cmd_options=()
    if [[ -n "$MT5_CMD_OPTIONS" ]]; then
        IFS='|' read -r -a mt5_cmd_options <<< "$MT5_CMD_OPTIONS"
    fi
    printf 'array input=%q\n' "$MT5_CMD_OPTIONS"
    printf 'array argc=%d argv:' "${`#mt5_cmd_options`[@]}"
    printf '<%s>' "${mt5_cmd_options[@]}"
    printf '\n'
}

show_current '/config:C:\Program Files\tester.ini /login:123'
show_array '/config:C:\Program Files\tester.ini|/login:123'

show_current '*.md'
show_array '*.md|/login:123'

show_current ''
show_array ''
BASH

Repository: marlonsc/mt5-docker

Length of output: 610


Preserve MT5_CMD_OPTIONS argument boundaries.

The unquoted expansion splits options that contain spaces and expands wildcards to filenames. Parse a documented separator-delimited format into an array, then use "${mt5_cmd_options[@]}".

🧰 Tools
🪛 Shellcheck (0.11.0)

[info] 74-74: Double quote to prevent globbing and word splitting.

(SC2086)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Metatrader/start.sh` at line 74, Update the command launch around
wine_executable and MT5_CMD_OPTIONS to parse the documented separator-delimited
option string into an array, preserving each argument’s boundaries without
wildcard expansion. Invoke the executable using the resulting quoted array
expansion, such as the mt5_cmd_options symbol, rather than unquoted
$MT5_CMD_OPTIONS.

Source: Linters/SAST tools

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: MT5 command-line options containing spaces or shell-special characters are not passed as a reliable argument list because $MT5_CMD_OPTIONS is unquoted. Quote the expansion if this variable represents one option string, or accept an array/structured argument interface if multiple options must be preserved independently.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Metatrader/start.sh, line 74:

<comment>MT5 command-line options containing spaces or shell-special characters are not passed as a reliable argument list because `$MT5_CMD_OPTIONS` is unquoted. Quote the expansion if this variable represents one option string, or accept an array/structured argument interface if multiple options must be preserved independently.</comment>

<file context>
@@ -70,7 +71,7 @@ fi
 if [ -e "$mt5file" ]; then
     show_message "[4/7] File $mt5file is installed. Running MT5..."
-    $wine_executable "$mt5file" &
+    $wine_executable "$mt5file" $MT5_CMD_OPTIONS &
 else
     show_message "[4/7] File $mt5file is not installed. MT5 cannot be run."
</file context>

else
Comment on lines 72 to 75
show_message "[4/7] File $mt5file is not installed. MT5 cannot be run."
fi
Expand Down
99 changes: 88 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This project provides a Docker image for running MetaTrader5 with remote access
- 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](https://github.com/kasmtech/KasmVNC) project.
- RPyC server for remote access to Python MetaTrader Library from Windows or Linux using https://github.com/lucas-campagna/mt5linux
- 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](https://imgur.com/v6Hm9pa.png)

Expand All @@ -18,7 +18,7 @@ Due to some compatibility issued, version 2 has switched its base from Alpine to

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

Expand All @@ -28,17 +28,20 @@ If you just need to run Metatrader for running your MQL5 programs without any Py
## Usage from repository

1. Clone this repository:

```bash
git clone https://github.com/gmag11/MetaTrader5-Docker-Image
cd MetaTrader5-Docker-Image
```

2. Build the Docker image:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n '^[[:space:]]*[0-9]+\.' README.md
if command -v markdownlint-cli2 >/dev/null 2>&1; then
  markdownlint-cli2 README.md
fi

Repository: marlonsc/mt5-docker

Length of output: 2926


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- README list context ---'
nl -ba README.md | sed -n '24,70p;112,140p'

printf '%s\n' '--- markdownlint configuration ---'
find . -maxdepth 2 -type f \( -iname '*markdownlint*' -o -name '.markdownlint*' \) -print
for f in $(find . -maxdepth 2 -type f \( -iname '*markdownlint*' -o -name '.markdownlint*' \)); do
  printf '\n--- %s ---\n' "$f"
  cat "$f"
done

Repository: marlonsc/mt5-docker

Length of output: 225


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- README list context ---'
awk 'NR >= 24 && NR <= 70 || NR >= 112 && NR <= 140 { printf "%d:%s\n", NR, $0 }' README.md

printf '%s\n' '--- markdownlint configuration ---'
find . -maxdepth 2 -type f \( -iname '*markdownlint*' -o -name '.markdownlint*' \) -print
while IFS= read -r f; do
  printf '\n--- %s ---\n' "$f"
  cat "$f"
done < <(find . -maxdepth 2 -type f \( -iname '*markdownlint*' -o -name '.markdownlint*' \))

Repository: marlonsc/mt5-docker

Length of output: 2420


Use 1. for each ordered-list item.

Change Lines 37, 43, 62, and 132 to use the configured 1. prefix. Line 124 starts a separate list after the thematic break, so Line 132 must also use 1..

🧰 Tools
🪛 markdownlint-cli2 (0.23.2)

[warning] 37-37: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1

(MD029, ol-prefix)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 37, Update the ordered-list entries at the referenced
README locations to use the Markdown prefix “1.” consistently, including the
entry at line 132 as the second item in the separate list after the thematic
break.

Source: Linters/SAST tools


```bash
docker build -t mt5 .
```

3. Run the Docker image:

```bash
docker run -d -p 3000:3000 -p 8001:8001 -v config:/config mt5
```
Expand All @@ -50,12 +53,14 @@ On first run it may take a few minutes to get everything installed and running.
## 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.

```bash
mkdir MT5
cd MT5
```

2. Create `docker-compose.yaml` file.

```bash
nano docker-compose.yaml
```
Expand Down Expand Up @@ -87,27 +92,54 @@ image: gmag11/metatrader5_vnc

by this one


```yaml
image: gmag11/metatrader5_vnc:1.1
```

3. Start the container
----------

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

```yaml
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:
```
Comment on lines +103 to +120

----------

1. Start the container

```bash
docker compose up -d

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n 'docker-compose-windows\.yaml|docker compose up -d|env_file|mt5_config|mt5-config' \
  README.md docker-compose-windows.yaml docker-compose.yaml

Repository: marlonsc/mt5-docker

Length of output: 554


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- README.md lines 90-135 ---'
sed -n '90,135p' README.md

printf '%s\n' '--- README.md lines 175-225 ---'
sed -n '175,225p' README.md

printf '%s\n' '--- docker-compose.yaml ---'
cat -n docker-compose.yaml

printf '%s\n' '--- docker-compose-windows.yaml ---'
cat -n docker-compose-windows.yaml

printf '%s\n' '--- environment-file references ---'
rg -n --hidden --glob '!*.lock' '(^|/)\.env($|[^A-Za-z])|env_file|MT5_|mt5-config|mt5_config' .

Repository: marlonsc/mt5-docker

Length of output: 3953


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- README.md setup instructions ---'
sed -n '1,90p' README.md

printf '%s\n' '--- .env.example ---'
if [ -f .env.example ]; then
  cat -n .env.example
else
  printf '%s\n' '.env.example is absent'
fi

printf '%s\n' '--- Compose-related documentation references ---'
rg -n -i 'compose|windows|\.env|environment|CUSTOM_USER|PASSWORD' README.md

Repository: marlonsc/mt5-docker

Length of output: 4726


Select the Windows Compose file explicitly.

The Windows instructions require the named-volume configuration, but docker compose up -d loads the default bind-mounted configuration. Use docker compose -f docker-compose-windows.yaml up -d and document copying .env.example to .env.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 127, Update the Windows setup instructions in README.md to
use docker-compose-windows.yaml explicitly when starting Compose, and document
copying .env.example to .env before launching the services.

```

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the Compose fallback sentence.

Change does not exists to does not exist. (raw.githubusercontent.com)

Proposed fix
-In some systems `docker compose` command does not exists.
+In some systems the `docker compose` command does not exist.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 130, Correct the grammar in the Docker Compose fallback
sentence by changing “does not exists” to “does not exist,” while preserving the
rest of the instruction unchanged.


4. Connect to web interface
Start your browser pointing http://<your ip address>:3000

Start your browser pointing `http://<your ip address>:3000`
Comment on lines +124 to +134

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

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

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

Expand All @@ -134,7 +166,7 @@ print(mt5.version())

Output should be something like this:

```
```python
(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.
Expand All @@ -148,20 +180,65 @@ True
```

## Configuration
The port configuration can be adjusted as per the instructions in the KasmVNC repository. Any additional configuration or environment variables needed to customize MetaTrader5 and KasmVNC running settings should be described here.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Command-line options containing spaces or shell-special characters will not reach MetaTrader 5 as documented because MT5_CMD_OPTIONS is expanded unquoted by the startup script. Please document that only shell-word-safe values are supported or change the launcher to parse/pass options safely (for example, an array-based interface).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At README.md, line 188:

<comment>Command-line options containing spaces or shell-special characters will not reach MetaTrader 5 as documented because `MT5_CMD_OPTIONS` is expanded unquoted by the startup script. Please document that only shell-word-safe values are supported or change the launcher to parse/pass options safely (for example, an array-based interface).</comment>

<file context>
@@ -148,20 +180,65 @@ True
+
+### 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:
</file context>
Suggested change
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.
You can pass shell-word-safe command line options to MetaTrader 5 using the `MT5_CMD_OPTIONS` environment variable. Options containing spaces or shell metacharacters are not supported by the current launcher.


Example using docker-compose:

```yaml
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:

```bash
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](https://www.metatrader5.com/en/terminal/help/start_advanced/start).

## 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](https://opensource.org/license/mit/).
This project is licensed under the terms of the [MIT license](https://opensource.org/license/mit/).

The [**KasmVNC**](https://github.com/kasmtech/KasmVNC) project is licensed under the [GNU General Public License v2.0 (GPLv2)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html). You can check the license details of KasmVNC [here](https://github.com/kasmtech/KasmVNC/blob/master/LICENSE.TXT).

[**KasmVNC Base Image from LinuxServer**](https://github.com/linuxserver/docker-baseimage-kasmvnc) is licensed unther the GNU General Public License v3.0 (GPLv3). License is available [here](https://github.com/linuxserver/docker-baseimage-kasmvnc/blob/master/LICENSE)
Comment on lines 236 to 238

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use descriptive license links and correct the spelling.

Replace the generic here labels with the license names. Change unther to under. These changes improve link accessibility and remove a user-facing typo. (raw.githubusercontent.com)

Proposed fix
-[here]
+[KasmVNC license file]

-licensed unther
+licensed under

-[here]
+[KasmVNC Base Image license file]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The [**KasmVNC**](https://github.com/kasmtech/KasmVNC) project is licensed under the [GNU General Public License v2.0 (GPLv2)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html). You can check the license details of KasmVNC [here](https://github.com/kasmtech/KasmVNC/blob/master/LICENSE.TXT).
[**KasmVNC Base Image from LinuxServer**](https://github.com/linuxserver/docker-baseimage-kasmvnc) is licensed unther the GNU General Public License v3.0 (GPLv3). License is available [here](https://github.com/linuxserver/docker-baseimage-kasmvnc/blob/master/LICENSE)
The [**KasmVNC**](https://github.com/kasmtech/KasmVNC) project is licensed under the [GNU General Public License v2.0 (GPLv2)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html). You can check the license details of KasmVNC [KasmVNC license file](https://github.com/kasmtech/KasmVNC/blob/master/LICENSE.TXT).
[**KasmVNC Base Image from LinuxServer**](https://github.com/linuxserver/docker-baseimage-kasmvnc) is licensed under the GNU General Public License v3.0 (GPLv3). License is available [KasmVNC Base Image license file](https://github.com/linuxserver/docker-baseimage-kasmvnc/blob/master/LICENSE)
🧰 Tools
🪛 LanguageTool

[grammar] ~238-~238: Ensure spelling is correct
Context: ...r/docker-baseimage-kasmvnc) is licensed unther the GNU General Public License v3.0 (GP...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🪛 markdownlint-cli2 (0.23.2)

[warning] 236-236: Link text should be descriptive

(MD059, descriptive-link-text)


[warning] 238-238: Link text should be descriptive

(MD059, descriptive-link-text)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 236 - 238, Update the KasmVNC license references in
the README to use descriptive link text such as the license name instead of
generic “here” labels, and correct “unther” to “under” in the LinuxServer
KasmVNC Base Image paragraph.

Source: Linters/SAST tools


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

# Acknowledgments
## Acknowledgments

Acknowledgments to the [KasmVNC](https://github.com/kasmtech/KasmVNC) project, [KasmVNC Base Image from LinuxServer](https://github.com/linuxserver/docker-baseimage-kasmvnc/tree/master), [mt5linux library](https://github.com/lucas-campagna/mt5linux) and any other project or individual that contributed to the realization of this project.
14 changes: 14 additions & 0 deletions docker-compose-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
mt5:
build: .
image: gmag11/metatrader5_vnc
container_name: mt5
volumes:
- mt5-config:/config
Comment on lines +6 to +7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n 'mt5-config|mt5_config' docker-compose-windows.yaml README.md

Repository: marlonsc/mt5-docker

Length of output: 437


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- docker-compose-windows.yaml ---'
cat -n docker-compose-windows.yaml
printf '%s\n' '--- README.md: Windows and volume examples ---'
sed -n '90,130p;185,225p' README.md
printf '%s\n' '--- volume identifiers and references ---'
rg -n -C 2 'mt5-config|mt5_config|docker-compose-windows|docker compose' --glob '!*.lock' .

Repository: marlonsc/mt5-docker

Length of output: 4367


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
import re

compose = Path("docker-compose-windows.yaml").read_text()
readme = Path("README.md").read_text()

compose_refs = sorted(set(re.findall(r'\bmt5[-_]config\b', compose)))
readme_refs = sorted(set(re.findall(r'\bmt5[-_]config\b', readme)))

print("docker-compose-windows.yaml identifiers:", compose_refs)
print("README.md identifiers:", readme_refs)
print("Windows compose and README identifiers match:", compose_refs == readme_refs)
PY

sed -n '88,123p' README.md

Repository: marlonsc/mt5-docker

Length of output: 898


Use mt5_config for both volume references.

Rename mt5-config in docker-compose-windows.yaml to match the Windows documentation. Different identifiers select different named volumes and can hide existing MT5 state.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docker-compose-windows.yaml` around lines 6 - 7, Update the volume reference
under the Compose service’s volumes section from mt5-config to mt5_config,
matching the Windows documentation and preserving the existing /config mount.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The managed volume is named mt5-config (hyphen) here, but the README's Windows configuration specifies mt5_config (underscore) both as the mount and in the top-level volumes section. It works internally since the name is consistent, but it deviates from the documented convention and will confuse anyone cross-referencing the README or scripts that expect mt5_config. Consider renaming to mt5_config for consistency.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docker-compose-windows.yaml, line 7:

<comment>The managed volume is named `mt5-config` (hyphen) here, but the README's Windows configuration specifies `mt5_config` (underscore) both as the mount and in the top-level volumes section. It works internally since the name is consistent, but it deviates from the documented convention and will confuse anyone cross-referencing the README or scripts that expect `mt5_config`. Consider renaming to `mt5_config` for consistency.</comment>

<file context>
@@ -0,0 +1,14 @@
+    image: gmag11/metatrader5_vnc
+    container_name: mt5
+    volumes:
+      - mt5-config:/config
+    ports:
+      - 3000:3000
</file context>

ports:
- 3000:3000
- 8001:8001
env_file:
- .env
volumes:
mt5-config:
Comment on lines +11 to +14

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informational

2. Windows compose diverges docs 🐞 Bug ⚙ Maintainability

The newly added docker-compose-windows.yaml is not referenced from README and differs from the
README Windows compose snippet (volume name and env configuration style), which can lead users to
inadvertently create a different persistent volume or fail to provide required env vars. This
increases configuration drift and setup failures for Windows users.
Agent Prompt
## Issue description
`docker-compose-windows.yaml` introduces a Windows-specific compose configuration, but README does not point to it and its defaults differ from the README Windows snippet.

## Issue Context
- README provides a Windows compose example using a named volume `mt5_config` and inline `environment:`.
- The new file uses a different volume name (`mt5-config`) and requires a `.env` via `env_file`, which is not mentioned near the Windows instructions.

## Fix Focus Areas
- docker-compose-windows.yaml[1-14]
- README.md[99-120]

## Suggested fix
Pick a single source of truth and align:
- Option A: Update README Windows section to explicitly reference `docker-compose-windows.yaml` and document creating `.env` (e.g., copy `.env.example` -> `.env`).
- Option B: Modify `docker-compose-windows.yaml` to match the README snippet (use `mt5_config` naming and inline `environment:`), or update the README snippet to match the file.
- Ensure volume naming matches to avoid users switching configs and "losing" persisted state.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools