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

2

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"]
docker
wine
asked on Stack Overflow May 15, 2020 by dommer • edited May 15, 2020 by dommer

1 Answer

1

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
answered on Stack Overflow May 15, 2020 by dommer

User contributions licensed under CC BY-SA 3.0