我有一个Win32应用程序,该应用程序公开REST端点并显示一个窗口来记录请求。它是用Delphi编写的,是32位的。
我已经使用Wine(4.0.4)在Ubuntu(20.04)中运行了它。它开箱即用。我创建一个32位前缀并启动它。一切都很好。这是一个干净的Ubuntu VM,仅安装了Wine。
我现在正尝试将其放置在Docker容器中,但无法使其运行。我正在使用xvfb-run
支持用户界面。
当我尝试在容器中运行该应用程序时,收到以下消息/警告/错误:
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(应用程序侦听的端口)发出请求时,我看到了报告的更多错误(并且没有返回响应-我关闭了套接字)。这些错误是:
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
由于容器在桌面环境中运行良好,因此我不确定容器中缺少什么。
我的Dockerfile如下:
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"]
答案 0 :(得分:1)
我解决了。下面的Dockerfile。
在启动我的应用之前,我还必须添加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