首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行嵌入在ubuntu或基于高山的docker image中的基于windows的应用程序

运行嵌入在ubuntu或基于高山的docker image中的基于windows的应用程序
EN

Stack Overflow用户
提问于 2020-08-17 03:59:33
回答 1查看 894关注 0票数 0

我们开发了基于Windows的应用程序,并尝试将其转换为在Linux基础环境下作为docker运行。不幸的是,第三方库中的一个不能转换到Linux环境。我们构建的docker镜像是ubuntu 16.04 + winetricks +winetricks,我们的应用程序可以在它上面运行,但所有3个组件(ubuntu,wine + winetrick)的重量都超过3 3GB。下面是Dockerfile的一部分,我们用它来构建docker镜像,我们的应用程序是64位的,并且结合了python和C++代码,我们如何才能减小docker的大小?在linux环境下,有没有其他方法可以将windows基础应用程序作为docker容器运行?

代码语言:javascript
复制
FROM ubuntu:16.04
# reccomended to add 32bit arch for wine
RUN dpkg --add-architecture i386 \
# install things to help install wine
 && apt-get update \
 && apt-get install -y  --allow-unauthenticated wget software-properties-common software-properties-common debconf-utils python-software-properties apt-transport-https cabextract telnet xvfb unzip build-essential \
# register repo and install winehq
 && wget -nc https://dl.winehq.org/wine-builds/Release.key \
 && apt-key add Release.key \
 && wget -nc https://dl.winehq.org/wine-builds/winehq.key \
 && apt-key add winehq.key \
 && apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/ \
 && apt-get update \
 && apt-get install -y xvfb \
 && apt-get install --install-recommends -y  --allow-unauthenticated winehq-stable

# setup vars for wine
ENV DISPLAY=":0.0"
ENV WINEARCH="win64"
ENV WINEPREFIX="/root/.wine64"
ENV WINESYSTEM32="/root/.wine64/drive_c/windows/system32"
ENV WINEDLLOVERRIDES="mscoree,mshtml="
ENV WINEDEBUG=-all


COPY scripts /root/scripts

# pull down winetricks, and install requirements
# vcrun2015 and vcrun2010 are Visual Studio C++ Redistributables
RUN set -e \
 && mkdir -p $WINEPREFIX \
 && cd $WINEPREFIX \
 && wget https://raw.githubusercontent.com/Winetricks/winetricks/20190615/src/winetricks \
 && chmod +x winetricks \
 && xvfb-run wine wineboot --init \
 && xvfb-run wineserver -w \
 && xvfb-run sh ./winetricks -q d3dx9 corefonts vcrun2015 

RUN set -x \
    && pythonVersions='python3.7' \
    && apt-get update \
    && apt-get install -y --allow-unauthenticated --no-install-recommends software-properties-common \
    && apt-add-repository -y ppa:deadsnakes/ppa  \
    && apt-get update \
    && apt-get install -y  --allow-unauthenticated --no-install-recommends $pythonVersions \
    && rm -rf /var/lib/apt/lists/* \
...
EN

回答 1

Stack Overflow用户

发布于 2020-12-10 06:05:07

你安装了许多不需要的软件包,你应该仔细阅读

https://www.dajobe.org/blog/2015/04/18/making-debian-docker-images-smaller/

这就解释了为什么

您应该删除xvfb (我猜您在安装和配置wine的过程中需要xvfb,但不是在安装和配置之后)和所有“推荐的”包

另请参阅

https://github.com/wagoodman/dive

如果您需要查看docker图像的效率,这是一个很好的工具

也可以使用

https://github.com/jwilder/docker-squash

它可以节省一些空间。

好猎杀

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63441411

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档