Closed luismasuelli closed 2 years ago
Yes, the path to MetaTrader seems to be correct, otherwise you probably wouldn't get that far.
There appears to be a problem with your DISPLAY environment variable, which is why Wine is unable to draw the GUI. So you might be correct in assuming that this is a problem on the host.
Are you actually running docker on a Linux host with a working desktop environment ? And if so, can you please check if the environment variable DISPLAY is set correctly (echo $DISPLAY) ?
In my case, I'm using MacOSX in the host. I think you're talking about having a DISPLAY (e.g. :0.0) variable referencing a display started with Xvfb. Am I right? If so, I will test it now.
However, another question comes to my mind: I'd be interested in running this container in an AWS Beanstalk, not just locally in my machine. How can I tweak this? I don't need actually any display from the terminal, since I'll actually adding Python on top of it (with MetaTrader5.initialize()).
De: tick notifications@github.com Enviado: jueves, 4 de febrero de 2021 09:40 Para: tickelton/docker-metatrader docker-metatrader@noreply.github.com Cc: luismasuelli luismasuelli@hotmail.com; Author author@noreply.github.com Asunto: Re: [tickelton/docker-metatrader] What else do I need to properly run this image? (#4)
Yes, the path to MetaTrader seems to be correct, otherwise you probably wouldn't get that far.
There appears to be a problem with your DISPLAY environment variable, which is why Wine is unable to draw the GUI. So you might be correct in assuming that this is a problem on the host.
Are you actually running docker on a Linux host with a working desktop environment ? And if so, can you please check if the environment variable DISPLAY is set correctly (echo $DISPLAY) ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/tickelton/docker-metatrader/issues/4#issuecomment-773359428, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AANZHHE5RA576VJA6RAJPGLS5KWW7ANCNFSM4XC3EC2Q.
In my case, I'm using MacOSX in the host.
That probably explains it. I only tested the container on Linux where there's an X display by default. I don't have a MacOSX host here to test the configuration on, so I can't really help you with that, but your reasoning seems sound. I you start an Xvfb display and set the appropriate environment variable that might work. Let me know how it went.
I'd be interested in running this container in an AWS Beanstalk
I can only speculate about that since I have never used Beanstalk. Do you know if it is possible to run MetaTrader in headless mode (i.e. without the GUI) ? I assume that that would work just fine in pretty much any environment, but I have never tried it and didn't have that use case in mind when I created the Dockerfile.
The headless mode, as you state, is the terminal itself. For example, assuming you use a Windows Python version, with pip, you can:
pip install MetaTrader5 (it does NOT exist in other distros because it makes no sense since it integrates with an actual MetaTrader5 interface)
Then you import it in Python:
import MetaTrader5
And run it:
initialized = MetaTrader5.initialize(path to terminal64.exe, login=1234567, password='Foo', server="MyMT5 Server")
(where server states for the configured server in your particular MT5 configuration, and not something like a host[:port] setting)
While now I at office, I can later make a time space to look out for this https://unix.stackexchange.com/questions/310679/how-to-poll-for-xvfb-to-be-ready and perhaps create a custom entry point to save the end user from the hassle of manually setting up a display. [https://cdn.sstatic.net/Sites/unix/Img/apple-touch-icon@2.png?v=32fb07f7ce26]https://unix.stackexchange.com/questions/310679/how-to-poll-for-xvfb-to-be-ready How to poll for Xvfb to be ready? - Unix & Linux Stack Exchangehttps://unix.stackexchange.com/questions/310679/how-to-poll-for-xvfb-to-be-ready By default Xvfb will create a Unix Domain socket for clients to connect. On my system this file socket file is created in /tmp/.X11-unix/.You could use inotifywait to listen for events in this directory. For example, $ inotifywait -e create /tmp/.X11-unix/ and then run Xvfb :9 (display 9, for example). When it is ready you should see unix.stackexchange.com
De: tick notifications@github.com Enviado: jueves, 4 de febrero de 2021 11:17 Para: tickelton/docker-metatrader docker-metatrader@noreply.github.com Cc: luismasuelli luismasuelli@hotmail.com; Author author@noreply.github.com Asunto: Re: [tickelton/docker-metatrader] What else do I need to properly run this image? (#4)
In my case, I'm using MacOSX in the host.
That probably explains it. I only tested the container on Linux where there's an X display by default. I don't have a MacOSX host here to test the configuration on, so I can't really help you with that, but your reasoning seems sound. I you start an Xvfb display and set the appropriate environment variable that might work. Let me know how it went.
I'd be interested in running this container in an AWS Beanstalk
I can only speculate about that since I have never used Beanstalk. Do you know if it is possible to run MetaTrader in headless mode (i.e. without the GUI) ? I assume that that would work just fine in pretty much any environment, but I have never tried it and didn't have that use case in mind when I created the Dockerfile.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/tickelton/docker-metatrader/issues/4#issuecomment-773427944, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AANZHHFYUKWGS5EEOZJPFWDS5LCAPANCNFSM4XC3EC2Q.
If I understand that correctly this means that this would also require a working installation of Python under Wine.
While that should technically be possible I have never tried anything like it. What you could try is run the container in interactive mode, start wine manually, install Python and the Python MetaTrader package, commit the changes to the image, and test if that works for you.
Adding Python is not that hard. We may look at the webcomics/pywine github repository (it works - I tested it). Now I'm strugging with keeping all the DISPLAY stuff there (I made some changes but still having issues).
De: tick notifications@github.com Enviado: viernes, 5 de febrero de 2021 03:45 Para: tickelton/docker-metatrader docker-metatrader@noreply.github.com Cc: luismasuelli luismasuelli@hotmail.com; Author author@noreply.github.com Asunto: Re: [tickelton/docker-metatrader] What else do I need to properly run this image? (#4)
If I understand that correctly this means that this would also require a working installation of Python under Wine.
While that should technically be possible I have never tried anything like it. What you could try is run the container in interactive mode, start wine manually, install Python and the Python MetaTrader package, commit the changes to the image, and test if that works for you.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/tickelton/docker-metatrader/issues/4#issuecomment-773886961, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AANZHHHA3HHYW6FLIZJUPWTS5OVY5ANCNFSM4XC3EC2Q.
That certainly sounds doable. I've never used MetaTrader from python though, so I'm not too familiar with the potential use cases. I can assist with creating a Dockerfile for that, but I'd need your feedback on if it actually works the way you need it to.
Can you provide some example scripts that would test the functionality you would need ? Or would you prefer to give it a shot yourself at creating the necessary Dockerfile ? I'd be willing to assist you as much as I can.
BTW: I'd prefer to create a separate Dockerfile for that. The default one here is intended for interactive use and since a lot of people seem to use it that way I think we should keep it like that and create a separate one for scripting.
I found this setup simple and sweet with as a starting point.
Rgd Ayib263
On Sat, 6 Feb 2021 at 17:24, tick notifications@github.com wrote:
That certainly sounds doable. I've never used MetaTrader from python though, so I'm not too familiar with the potential use cases. I can assist with creating a Dockerfile for that, but I'd need your feedback on if it actually works the way you need it to.
Can you provide some example scripts that would test the functionality you would need ? Or would you prefer to give it a shot yourself at creating the necessary Dockerfile ? I'd be willing to assist you as much as I can.
BTW: I'd prefer to create a separate Dockerfile for that. The default one here is intended for interactive use and since a lot of people seem to use it that way I think we should keep it like that and create a separate one for scripting.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tickelton/docker-metatrader/issues/4#issuecomment-774502309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7JXS2ES7ZNC3SHJ2OJ7G3S5VUNLANCNFSM4XC3EC2Q .
--
Kudakwashe Mafutah [image: https://]about.me/kmafutah https://about.me/kmafutah?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel&utm_content=plaintext
Closed due to inactivity.
I have the same problem.
I have this command line:
$ docker run -it --rm --net host --name sample -v "$(pwd)/MetaTrader5:/MetaTrader" -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY tickelton/mt
(I can confirm the path to MetaTrader5 exists)
But get these errors:
(Perhaps there's something else to do in the host, and not on the docker; don't know - totally new to wine) What am I missing?