gmag11 / MetaTrader5-Docker-Image

Docker image that runs Metatrader 5 with VNC web server
MIT License
89 stars 38 forks source link

How to move step `install metatrader5` to Dockerfile? #1

Closed CaoDuyThanh closed 8 months ago

CaoDuyThanh commented 8 months ago

Thank you for your repository, I can run the build and start docker on my local computer so It's not actually an issue but about how to move step install Metatrader5 to Dockerfile. More specific, I see your pipeline like this

Create docker image --> Install winehd-stable --> Start container --> Install mono, Metatrader5, python and mt5linux

My question is why you install mono, Metatrader5, python and mt5linux when start container instead of installing when build docker? I tried to move them to Dockerfile but I got this error when run docker build

0128:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0128:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
0128:err:systray:initialize_systray Could not create tray window

Although showing this error, I think it still install mono successfully (because mono is msi file?) but fail to install Metatrader and Python. Do you know the reason for this?

Notes: the reason I want to move to Dockerfile is I want to prepare everything (application and libs) inside docker image and push this image to cloud service then I just pull this image and use.

hazzlim commented 8 months ago

Hi @CaoDuyThanh did you get any further with this? As I would be interested.

Thanks!

gmag11 commented 8 months ago

Hi, you don't need to interact with container to get everything installed inside. It does it automatically.

I've updated the README file. Check instructions for Docker Compose

avivbiton commented 8 months ago

@gmag11 The issue is not the automatic install. The issue it takes time to spin up a new instance from scratch. And I also have this issue. In my case I don't want to have volume mapping. I also have many instances running different scripts so it will be nice to have the image with already the mt5 installed. I guess one solution will be to provide the files yourself and copy them inside the image but then if there is an update it won't update it automatically.

gmag11 commented 8 months ago

Yes, I misunderstood your question. Metatrader is a commercial software and I do not want to distribute it. That's why I designed this to download installer on start. If you do not map a volume, MT5 will be installed inside container, but this will not be persistent. So anytime it get recreated the installation will happen again. It is just a few minutes so maybe you can live with it.

In order to include your files inside a new image you don't need to reconstruct this Dockerfile. Just use gmag11/metatrader5_vnc:1.0 as a start using FROM statement in your own Dockerfile. Then you may add any file you want to your MQL5 folder in during the build process. Just keep in mind to adjust the correct permissions and owners for new files.

I personally think that using Docker volumes is a better approach but I don't have all details about your user case.