tickelton / docker-metatrader

MetaTrader4/5 in a container
ISC License
117 stars 52 forks source link

What else do I need to properly run this image? #4

Closed luismasuelli closed 2 years ago

luismasuelli commented 3 years ago

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:

0048:err:explorer:initialize_display_settings Failed to query current display settings for L"\\\\.\\DISPLAY1".
0048:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x80004002
0048:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x80004002
0048:err:ole:apartment_get_local_server_stream Failed: 0x80004002
002c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
002c:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
0050:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0050:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 0
0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 0
0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 14007
0050:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x800736b7
0050:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x800736b7
0050:err:ole:apartment_get_local_server_stream Failed: 0x800736b7
0050:err:ole:start_rpcss Failed to open RpcSs service
0040:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0040:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
0060:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0060:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
0068:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0068:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
Could not find Wine Gecko. HTML rendering will be disabled.
009c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
009c:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
00a4:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
00a4:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
Could not find Wine Gecko. HTML rendering will be disabled.
wine: configuration in L"/home/wine/.wine" has been updated.
00ec:err:winediag:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
00ec:fixme:heap:RtlSetHeapInformation 0000000001AE0000 0 000000000021F1F0 4 stub
00ec:fixme:ole:CoInitializeSecurity 0000000000000000, -1, 0000000000000000, 0000000000000000, 0, 3, 0000000000000000, 0, 0000000000000000 stub
00ec:fixme:wbemprox:client_security_SetBlanket 0000000001EBFD50, 0000000000097AC0, 10, 0, (null), 3, 3, 0000000000000000, 0x00000000
00ec:fixme:wbemprox:client_security_Release 0000000001EBFD50
00ec:err:d3d:wined3d_adapter_create_output Failed to initialise output L"\\\\.\\DISPLAY1", hr 0x80070057.
00ec:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
00ec:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 0000000000215014, 0000000000215030 0000000000215010
00ec:fixme:nls:get_dummy_preferred_ui_language (0x38 0000000000215014 0000000000215030 0000000000215010) returning a dummy value (current locale)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
00ec:fixme:iphlpapi:GetTcpStatisticsEx unimplemented for IPv6
00f8:fixme:kernelbase:AppPolicyGetThreadInitializationType FFFFFFFFFFFFFFFA, 000000000254FE10
0100:fixme:kernelbase:AppPolicyGetThreadInitializationType FFFFFFFFFFFFFFFA, 000000000296FE10
00fc:fixme:kernelbase:AppPolicyGetThreadInitializationType FFFFFFFFFFFFFFFA, 000000000275FE10
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
00ec:fixme:ntdll:NtQueryInformationToken QueryInformationToken( ..., TokenElevation, ...) semi-stub
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0130:fixme:secur32:schan_QueryContextAttributesW Unhandled attribute 0x6e
011c:err:winediag:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
011c:fixme:heap:RtlSetHeapInformation 0000000001590000 0 000000000021F1F0 4 stub
011c:fixme:ole:CoInitializeSecurity 0000000000000000, -1, 0000000000000000, 0000000000000000, 0, 3, 0000000000000000, 0, 0000000000000000 stub
011c:fixme:wbemprox:client_security_SetBlanket 0000000001A9FD50, 00000000000CDA50, 10, 0, (null), 3, 3, 0000000000000000, 0x00000000
011c:fixme:wbemprox:client_security_Release 0000000001A9FD50
011c:err:d3d:wined3d_adapter_create_output Failed to initialise output L"\\\\.\\DISPLAY1", hr 0x80070057.
015c:fixme:kernelbase:AppPolicyGetThreadInitializationType FFFFFFFFFFFFFFFA, 000000000613FE10
00ec:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
00ec:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
011c:fixme:kernelbase:AppPolicyGetProcessTerminationMethod FFFFFFFFFFFFFFFA, 000000000021FD70
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0090:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
0090:fixme:mountmgr:query_property Faking StorageDeviceProperty data
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
0090:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
0130:fixme:server:invoke_system_apc syscall frame changed in APC function, frame (nil), saved_frame 0x8699998.
00ec:fixme:kernelbase:AppPolicyGetProcessTerminationMethod FFFFFFFFFFFFFFFA, 000000000021FD70

(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?

tickelton commented 3 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) ?

luismasuelli commented 3 years ago

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.

tickelton commented 3 years ago

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.

luismasuelli commented 3 years ago

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.

tickelton commented 3 years ago

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.

luismasuelli commented 3 years ago

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.

tickelton commented 3 years ago

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.

kmafutah commented 3 years ago

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

tickelton commented 2 years ago

Closed due to inactivity.

RedFox64 commented 1 year ago

I have the same problem.