我正在尝试让.NET应用程序在Docker容器中运行在Windows上,它需要.NET 4。我已经让它在32位运行,但我需要64位来提供额外的内存空间。这是一个专门的科学应用程序。
下面是Dockerfile:
FROM ubuntu:16.04
# we need wget, bzip2, wine from winehq,
# xvfb to fake X11 for winetricks during installation,
# and winbind because wine complains about missing
# Prevents annoying debconf errors during builds
ARG DEBIAN_FRONTEND="noninteractive"
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y \
software-properties-common \
winbind \
cabextract \
p7zip \
unzip \
wget \
zenity \
xvfb && \
apt-get -y clean && \
rm -rf \
/var/lib/apt/lists/* \
/usr/share/doc \
/usr/share/doc-base \
/usr/share/man \
/usr/share/locale \
/usr/share/zoneinfo
ENV WINEDISTRO=staging
ENV WINEVERSION=3.12.0~xenial
# Install wine
RUN wget -nc https://dl.winehq.org/wine-builds/Release.key \
&& apt-key add Release.key \
&& apt-get update \
&& apt-get install -y apt-transport-https \
&& add-apt-repository https://dl.winehq.org/wine-builds/ubuntu/ \
&& apt-get update \
&& apt-get install -y --install-recommends winehq-$WINEDISTRO=$WINEVERSION wine-$WINEDISTRO=$WINEVERSION wine-$WINEDISTRO-i386=$WINEVERSION wine-$WINEDISTRO-amd64=$WINEVERSION && \
apt-get -y clean && \
rm -rf \
/var/lib/apt/lists/* \
/usr/share/doc \
/usr/share/doc-base \
/usr/share/man \
/usr/share/locale \
/usr/share/zoneinfo \
&& \
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks \
-O /usr/local/bin/winetricks && chmod +x /usr/local/bin/winetricks
# put C:\pwiz on the Windows search path
ENV WINEARCH win64
ENV WINEDEBUG -all,err+all
# To be singularity friendly, avoid installing anything to /root
RUN mkdir -p /wineprefix64/
ENV WINEPREFIX /wineprefix64
WORKDIR /wineprefix64
# wineserver needs to shut down properly!!!
ADD waitonprocess.sh /wineprefix64/waitonprocess.sh
RUN chmod +x waitonprocess.sh
# Install dependencies
RUN winetricks -q win7 && xvfb-run winetricks -q dotnet45 && ./waitonprocess.sh wineserver我试过葡萄酒和3.13,3.12,3.11,3.10,3.9,结果差不多。如果我安装在干净的前缀上,我实际上很快就会得到一个错误:
Step 4/47 : FROM ubuntu:16.04
Step 19/47 : ARG DEBIAN_FRONTEND="noninteractive"
Step 20/47 : RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y software-properties-common winbind cabextract p7zip unzip wget zenity xvfb && apt-get -y clean && rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/doc-base /usr/share/man /usr/share/locale /usr/share/zoneinfo
Step 21/47 : ENV WINEDISTRO=staging
Step 22/47 : ENV WINEVERSION=3.13.0~xenial
Step 23/47 : RUN wget -nc https://dl.winehq.org/wine-builds/Release.key && apt-key add Release.key && apt-get update && apt-get install -y apt-transport-https && add-apt-repository https://dl.winehq.org/wine-builds/ubuntu/ && apt-get update && apt-get install -y --install-recommends winehq-$WINEDISTRO=$WINEVERSION wine-$WINEDISTRO=$WINEVERSION wine-$WINEDISTRO-i386=$WINEVERSION wine-$WINEDISTRO-amd64=$WINEVERSION && apt-get -y clean && rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/doc-base /usr/share/man /usr/share/locale /usr/share/zoneinfo && wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks -O /usr/local/bin/winetricks && chmod +x /usr/local/bin/winetricks
Step 24/47 : ENV WINEARCH win64
Step 25/47 : ENV WINEDEBUG -all,err+all
Step 28/47 : RUN mkdir -p /wineprefix64/
Step 29/47 : ENV WINEPREFIX /wineprefix64
Step 30/47 : WORKDIR /wineprefix64
Step 31/47 : ADD waitonprocess.sh /wineprefix64/waitonprocess.sh
Step 32/47 : RUN chmod +x waitonprocess.sh
Step 34/47 : RUN xvfb-run winetricks -q dotnet45 && ./waitonprocess.sh wineserver
---> Running in c0f8d76792c5
------------------------------------------------------
Running Wine/winetricks as root is highly discouraged. See https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F
------------------------------------------------------
------------------------------------------------------
wine cmd.exe /c echo '%ProgramFiles%' returned unexpanded string '%ProgramFiles%' ... this can be caused by a corrupt wineprefix, by an old wine, or by not owning /wineprefix64
------------------------------------------------------
The command '/bin/sh -c xvfb-run winetricks -q dotnet45 && ./waitonprocess.sh wineserver' returned a non-zero code: 1如果我先安装一个操作系统版本,那么它会走得更远,最后会挂起。wine-staging-3.12-amd64-win7-dotnet45 build log
3.13的结果非常相似。结果是一样的。我做了很多搜索,几乎所有的事情都是关于如何让它在32位的东西上工作。我见过的几个64位线程并没有给出如何手动安装.NET 4的足够详细信息。
发布于 2018-08-18 01:10:28
我发现问题在于我使用的是winehq-staging而不是winehq-devel。当winehq-devel=3.12.0~xenial时,winetricks中的dotnet40动词起作用。实际上,即使是dotnet472动词现在也可以与最新版本一起工作。
https://stackoverflow.com/questions/51850314
复制相似问题