Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get my Win32 app running with Wine in Docker?

Tags:

docker

wine

I have a Win32 app that exposes a REST endpoint and displays a window to log requests. It's written in Delphi and is 32-bit.

I've run it in Ubuntu (20.04) using Wine (4.0.4). It runs straight out of the box. I create a 32-bit prefix and launch it. All is well. It's a clean Ubuntu VM with only Wine installed.

I'm now trying to place it in a Docker container, but I can't get it to run. I'm using xvfb-run to support the UI.

When I attempt to run the app in my container I get the follow messages/warnings/errors:

0010:err:ole:marshal_object couldn't get IPSFactory buffer for interface {00000131-0000-0000-c000-000000000046}
0010:err:ole:marshal_object couldn't get IPSFactory buffer for interface {6d5140c1-7436-11ce-8034-00aa006009fa}
0010:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hres=0x80004002
0010:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, 80004002
0010:err:ole:get_local_server_stream Failed: 80004002

The app does seem to start, though. When I make a request to port 9000 (the port the app listens on) I see more errors reported (and don't get a response back---I get socket closed). Those errors are:

0019:err:ole:CoGetClassObject class {88d96a05-f192-11d4-a65f-0040963251e5} not registered
0019:err:ole:create_server class {88d96a05-f192-11d4-a65f-0040963251e5} not registered
0019:err:ole:CoGetClassObject no class object {88d96a05-f192-11d4-a65f-0040963251e5} could be created for context 0x5

I'm not sure what I'm missing from my container, given it runs fine in the desktop environment.

My Dockerfile is as follows:

FROM ubuntu:20.04

RUN apt-get update

RUN apt-get install -y wget software-properties-common gnupg2 xvfb

RUN dpkg --add-architecture i386
RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key
RUN apt-key add winehq.key
RUN add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
RUN apt-get update
RUN apt-get install -y winehq-stable winetricks winbind

RUN apt-get clean -y
RUN apt-get autoremove -y

ENV WINEDEBUG=fixme-all

ENV WINEPREFIX=/root/.catalyst
ENV WINEARCH=win32
RUN xvfb-run winecfg

RUN winetricks msxml6

WORKDIR /root

COPY app catalyst

EXPOSE 9000

CMD ["xvfb-run", "wine", "/root/catalyst/CATALYSTWeb.exe"]
like image 214
dommer Avatar asked May 15 '20 08:05

dommer


People also ask

How do I run wine in a Docker container?

Running Wine within a Docker container $ docker run --rm wine1. 4 wine "C:\windows\system32\notepad.exe" wine: created the configuration directory '/root/. wine' Application tried to create a window, but no driver could be loaded. Make sure that your X server is running and that $DISPLAY is set correctly.

Can Docker run Windows apps?

You can run any application in Docker as long as it can be installed and executed unattended, and the base operating system supports the app. Windows Server Core runs in Docker which means you can run pretty much any server or console application in Docker.

Can Docker run Windows apps on Linux?

No, you cannot run Windows containers directly on Linux. But you can run Linux on Windows. You can change between OS containers Linux and Windows by right clicking on the Docker in the tray menu.


1 Answers

I solved it. Dockerfile below.

I also had to add a sleep 1s before launching my app to allow some services to start.

FROM ubuntu:20.04

RUN apt-get update

RUN apt-get install -y wget software-properties-common gnupg2 winbind xvfb

RUN dpkg --add-architecture i386
RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key
RUN apt-key add winehq.key
RUN add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
RUN apt-get update
RUN apt-get install -y winehq-stable

RUN apt-get install -y winetricks

RUN apt-get clean -y
RUN apt-get autoremove -y

ENV WINEDEBUG=fixme-all

RUN winetricks msxml6

COPY app /root/catalyst
COPY startup.sh /root/startup.sh
RUN chmod gou+x /root/startup.sh

EXPOSE 9000

CMD ["/root/startup.sh"]

startup.sh is

#!/usr/bin/env bash

sleep 1s
xvfb-run wine /root/catalyst/CATALYSTMWeb.exe
like image 159
dommer Avatar answered Sep 21 '22 16:09

dommer