tickelton / docker-metatrader

MetaTrader4/5 in a container
ISC License
112 stars 53 forks source link

Metatrader Failed Installation Within Docker Image #10

Open lloydmcl opened 1 year ago

lloydmcl commented 1 year ago

Firstly, thank you for sharing this. It's got me a step closer to speeding up my development efforts.

The issue I'm having is when I attempt the installation of MT5 within the docker container, I get the following:

$ wine /home/wine/mt5setup.exe wine: created the configuration directory '/home/wine/.wine' 002c:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0) 0048:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0) 0050:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0) 0048:err:explorer:initialize_display_settings Failed to query current display settings for L"\\.\DISPLAY1". 0048:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0048:err:winediag:nodrv_CreateWindow L"The explorer process failed to start." 0048:err:systray:initialize_systray Could not create tray window 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 L"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 L"Make sure that your X server is running and that $DISPLAY is set correctly." 0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 3 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 L"Make sure that your X server is running and that $DISPLAY is set correctly." 008c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 008c:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly." 0094:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0094:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly." 00e0:fixme:msg:pack_message msg 14 (WM_ERASEBKGND) not supported yet 00e0:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 00e0:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly." 0110:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 wine: configuration in L"/home/wine/.wine" has been updated. 0110:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0110:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0110:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0174:err:explorer:initialize_display_settings Failed to query current display settings for L"\\.\DISPLAY1". 0174:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0174:err:winediag:nodrv_CreateWindow L"The explorer process failed to start." 0174:err:systray:initialize_systray Could not create tray window 0148:err:winediag:ntlm_check_version 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. 0148:err:ntlm:ntlm_LsaApInitializePackage no NTLM support, expect problems 0148:fixme:ole:CoInitializeSecurity 0000000000000000, -1, 0000000000000000, 0000000000000000, 0, 3, 0000000000000000, 0, 0000000000000000 stub 0148:fixme:wbemprox:client_security_SetBlanket 00000000030CFE40, 0000000001C798B0, 10, 0, (null), 3, 3, 0000000000000000, 0 0148:fixme:wbemprox:client_security_Release 00000000030CFE40 0148:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0148:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly." 0148:err:d3d:wined3d_caps_gl_ctx_create Failed to create a window. 0148:err:d3d:wined3d_adapter_gl_init Failed to get a GL context for adapter 000000000099A010. 0148:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION 0078:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS 0078:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0) 0078:fixme:mountmgr:query_property Faking StorageDeviceProperty data 0078:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0) 0078:fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS 0078:fixme:mountmgr:query_property Faking StorageDeviceProperty data 0078:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0) 0078:fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0) 0184:fixme:kernelbase:AppPolicyGetThreadInitializationType FFFFFFFFFFFFFFFA, 00000000038AFE10 0184:fixme:secur32:schan_QueryContextAttributesW Unhandled attribute 0x6e 018c:fixme:secur32:schan_QueryContextAttributesW Unhandled attribute 0x6e 018c:fixme:secur32:schan_QueryContextAttributesW Unhandled attribute 0x6e 018c:fixme:secur32:schan_QueryContextAttributesW Unhandled attribute 0x6e 018c:fixme:secur32:schan_QueryContextAttributesW Unhandled attribute 0x6e 0148:fixme:kernelbase:AppPolicyGetProcessTerminationMethod FFFFFFFFFFFFFFFA, 000000000085FD40

I have checked the wine folder and can see that unfortunately MT5 did not install. From the error, it looks as if it needs an interactive installation with display output.

I am yet to try the installation on my host. Was hoping to keep this a scripted approach with installation within the container. But that may not be possible. Have you seen this error before? Any ideas on how I can resolve it?

lloydmcl commented 1 year ago

Tried with a copied version of an MT5 installation from the host and similar error:

002c:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0) 0048:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0) 0050:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0) 0048:err:explorer:initialize_display_settings Failed to query current display settings for L"\\.\DISPLAY1". 0048:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0048:err:winediag:nodrv_CreateWindow L"The explorer process failed to start." 0048:err:systray:initialize_systray Could not create tray window 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 0050:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0050:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly." 0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 3 0040:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0040:err:winediag:nodrv_CreateWindow L"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 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 002c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 002c:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly." 008c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 008c:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly." 0094:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0094:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly." 00d8:fixme:msg:pack_message msg 14 (WM_ERASEBKGND) not supported yet 00d8:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 00d8:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly." 0100:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 wine: configuration in L"/home/wine/.wine" has been updated. 0100:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0100:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0100:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 wine: Unhandled page fault on execute access to 0000000141E88000 at address 0000000141E87FFF (thread 012c), starting debugger... 0134:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0134:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly." Unhandled exception: page fault on execute access to 0x0000000141e88000 in 64-bit code (0x00000141e87fff). Register dump: rip:0000000141e87fff rsp:000000000011fe38 rbp:0000000000000000 eflags:00010292 ( R- -- I S -A- - ) rax:000000017008d048 rbx:0000000000000000 rcx:0000000067ff0000 rdx:0000000141c0a743 rsi:0000000000000000 rdi:0000000000000000 r8:0000000067ff0000 r9:0000000170080c68 r10:0000000000000000 r11:0000000000000000 r12:0000000000000000 r13:0000000000000000 r14:0000000000000000 r15:0000000000000000 Stack dump: 0x0000000011fe38: 000000007b629669 0000000000000000 0x0000000011fe48: 000000000011fe90 0000000000000000 0x0000000011fe58: 0000000000000000 0000000000000000 0x0000000011fe68: 0000000170064323 0000000000000000 0x0000000011fe78: 0000000000000000 0000000000000000 0x0000000011fe88: 0000000000000000 0000000141c0a743 0x0000000011fe98: 0000000067ff0000 ffffffffffffffff 0x0000000011fea8: 000000017006f9d0 00000001700281d0 0x0000000011feb8: 0000000000000000 000000000011fea0 0x0000000011fec8: 0000000000000000 000000000011fe70 0x0000000011fed8: 0000000000000000 0000000000000000 0x0000000011fee8: 0000000000000000 0000000000000000 Backtrace: =>0 0x00000141e87fff in terminal64 (+0x1e87fff) (0000000000000000) 1 0x0000007b629669 BaseThreadInitThunk+0x9(unknown=, entry=, arg=) [Z:\usr\src\packages\BUILD\dlls\kernel32\thread.c:61] in kernel32 (0000000000000000) 2 0x00000170064323 __wine_pop_frame(unknown=, entry=, arg=) [Z:\usr\src\packages\BUILD\include\wine\exception.h:277] in ntdll (0000000000000000) 3 0x00000170064323 RtlUserThreadStart+0x83(entry=[, arg=[) [Z:\usr\src\packages\BUILD\dlls\ntdll\thread.c:240] in ntdll (0000000000000000) 0x00000141e87fff terminal64+0x1e87fff: addb %al,(%rax) Modules: Module Address Debug info Name (4 modules) PE 000000007b000000-000000007b5bb000 Deferred kernelbase PE 000000007b600000-000000007b799000 Dwarf-4 kernel32 PE 0000000140000000-00000001445cf000 Export terminal64 PE 0000000170000000-0000000170384000 Dwarf-4 ntdll Threads: process tid prio name (all IDs are in hex) 00000020 start.exe 00000024 0 00000030 services.exe 00000034 0 00000038 0 0000005c 0 0000006c 0 00000070 0
000000ac 0 000000c0 0 000000f4 0 00000044 explorer.exe 00000048 0 00000064 winedevice.exe 00000068 0 00000074 0 00000078 0 0000007c 0 00000080 0 000000d0 0 000000a4 svchost.exe 000000a8 0 000000b0 0 000000b4 0 000000b8 plugplay.exe 000000bc 0 000000c4 0 000000c8 0 000000cc 0 00000120 0 00000124 0 000000ec winedevice.exe 000000f0 0 000000f8 0 000000fc 0 00000100 0 00000104 0 00000110 0 00000114 0 00000118 0 0000011c 0 00000128 (D) Z:\MetaTrader\terminal64.exe 0000012c 0 <== 00000138 0

tickelton commented 1 year ago

These containers are only designed to run MT from an existing installation, not to install it from scratch.
I installed MT in portable mode on a windows host and then archived this installation directory for use in containers.

There was a reason why I chose this approach but I'm not entirely sure what it was. IIRC I encountered issues when trying to use the container for also installing MT.

About your error running the container with an existing installation: 0048:err:explorer:initialize_display_settings Failed to query current display settings for L"\\.\DISPLAY1". Seems like your $DISPLAY variable is not set correctly. Where are you running the container ? Causes for the error might be:

lloydmcl commented 1 year ago

This makes sense, my MT5 installation was performed on a windows 10 host but was not performed in portable mode.

I am running the container from command line precisely as documented in the readme. Building locally and then running container. docker build . -t tickelton/mt

docker run --net host -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY -v "C:\Program Files\MetaTrader 5:/MetaTrader" --name mt tickelton/mt

Perhaps my issue is related to the portable install of MT5. I can test that out now.

lloydmcl commented 1 year ago

Just learnt there is no installation in portable mode, it is a parameter when executing the application. In that case, I am running it in portable mode as this is specified as the entrypoint in the docker file. Am thinking my issue lies with the X11 display server. I have never used this before, so apologies if I'm being a noob. Will read up on it now.

tickelton commented 1 year ago

What does echo $DISPLAY say on your host ?

lloydmcl commented 1 year ago

Empty variable. Should it return an X11 server endpoint?

tickelton commented 1 year ago

Yes should look something like this:

$ echo $DISPLAY
:0.0

Which Linux distribution and version are you running ?

lloydmcl commented 1 year ago

This is all running on a windows 10 host, which I think is my issue. I can run this on an Ubuntu Focal VM. Or I can install an X11 server like xming. Will try that out and see how I go. Really appreciate your guidance @tickelton

tickelton commented 1 year ago

I've never used Docker on Windows so I can't comment if that's going to work. Ubuntu Focal should work, though.

tickelton commented 1 year ago

BTW: running this on windows, or worse on a Linux VM in Windows, is probably not a good idea. You'll take a massive performance hit.
Even running natively on Linux Wine isn't exactly fast. Running a Windows emulator in a Linux virtual machine on a Windows host is going to be way worse.

lloydmcl commented 1 year ago

I have the option of running this on MAC OSX which is what I'm intending to do. Unfortunately for me, I'm developing with the MT5 python module which requires Python on Windows :(

tickelton commented 1 year ago

I don't think I fully understand your use case, but it seems like this container isn't really suited for what you're doing. If you want to use python-MetaTrader5 you'll probably also need that module and a full python runtime in the container. If your host is Windows anyway you'd be much better off running natively there. The main use case for this container was getting rid of the Windows host in the first place and being able to run MetaTrader on Linux, but that only works well if your workflow doesn't have any additional outside dependencies like, in your case, python-MetaTrader5.

lloydmcl commented 1 year ago

Thank you for the advice.

Yes, I was planning to expand on your docker image to include the python runtime. I already have my development working natively on windows 10. But I wanted to create something that I could easily transport to work on in an AWS EC2 instance, a mac os, a windows host etc etc remaining consistent regardless of host. Which is why I'm looking at a docker container.