12

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"]
dommer
  • 19,610
  • 14
  • 75
  • 137

2 Answers2

12

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
dommer
  • 19,610
  • 14
  • 75
  • 137
  • 4
    This `Dockerfile` is written badly. Too many redundant layers that only add bloat to the image size. For example, the `apt-get clean` and `apt-get autoremove` lines does nothing useful because they are run on separate layers. – iBug Mar 08 '22 at 18:39
  • @iBug can you provide an improved example, as answer? For a Docker novice it is not clear how you’d run them in the same layer. – Andre M Aug 18 '23 at 17:46
  • @AndreM Siri-Piell's answer is a better example, except for failing to consolidate cleanup steps (e.g. `apt-get clean`) into the same `apt-get install` layer. – iBug Aug 19 '23 at 06:57
2

Here is a better version of your DockerFile:

FROM ubuntu:20.04

# Specify a workdir, to better organize your files inside the container. 
WORKDIR /yourapp

# Update package lists and install required packages
RUN apt-get update && \
    apt-get install -y wget software-properties-common gnupg2 winbind xvfb

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

# Install additional packages and configure Wine
RUN apt-get install -y winetricks && \
    winetricks msxml6

# Cleanup unnecessary files
RUN apt-get clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV WINEDEBUG=fixme-all

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

EXPOSE 9000

CMD ["/root/startup.sh"]
Siri-Piell
  • 31
  • 5
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 02 '23 at 16:55
  • Can you explain upon what ways this is better? This would help beyond the specific solution and people to understand why you did certain things. – Andre M Aug 18 '23 at 17:42