Reputation: 19810
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"]
Upvotes: 15
Views: 21128
Reputation: 21
The all other answers create a new layer which removes the APT caches, but the caches are still present in the layers above. The only way you can be sure that no APT caches are present in the final image, is to do everything related to APT in a single layer, like this:
# Updated to Ubuntu 22.04
FROM ubuntu:22.04
# Download/install WineHQ key (linking the ADD layer to the FROM layer)
# This way we don't need the wget command to get download the key file
ADD --link=true https://dl.winehq.org/wine-builds/winehq.key /etc/apt/keyrings/winehq-archive.key
# Update package lists and install required packages
RUN dpkg --add-architecture i386 \
&& add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ jammy main' \
&& apt-get update \
&& apt-get install -y \
winehq-stable \
wget \
software-properties-common \
gnupg2 \
winbind \
xvfb \
winetricks \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& winetricks msxml6
ENV WINEDEBUG=fixme-all
# Specify a workdir, to better organize your files inside the container
WORKDIR /yourapp
# Copy files into container and link the COPY instructions
# to the previously created WORKDIR layer
COPY --link=true app /root/catalyst
COPY --link=true startup.sh /root/startup.sh
# Finish up
RUN chmod gou+x /root/startup.sh
EXPOSE 9000
CMD ["/root/startup.sh"]
Upvotes: 2
Reputation: 41
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"]
Upvotes: 2
Reputation: 19810
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
Upvotes: 12