如何让我的Win32应用在Docker中用Wine运行?

问题描述 投票:2回答:1

我有一个Win32应用程序,它暴露了一个REST端点,并显示一个窗口来记录请求。它是用Delphi编写的,是32位的。

我在Ubuntu (20.04)中使用Wine (4.0.4)运行它。它可以直接运行。我创建了一个32位的前缀并启动它。一切都很好。这是一个干净的Ubuntu虚拟机,只安装了Wine。

我现在试图把它放在一个Docker容器中,但我无法让它运行。我正在使用 xvfb-run 来支持用户界面。

当我试图在我的容器中运行该应用程序时,我得到了以下的消息warningserrors。

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

该应用程序 是否 似乎启动了,但。当我向9000端口(应用程序监听的端口)发出请求时,我看到了更多的错误报告(并且没有得到响应--我得到的是socket关闭)。这些错误是

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

我不知道我的容器缺失了什么,因为它在桌面环境下运行良好。

我的Docker文件如下。

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
1个回答
1
投票

我解决了这个问题。下面是Docker文件。

我还不得不添加了一个 sleep 1s 在启动我的应用程序之前,允许一些服务启动。

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

#!/usr/bin/env bash

sleep 1s
xvfb-run wine /root/catalyst/CATALYSTMWeb.exe
© www.soinside.com 2019 - 2024. All rights reserved.