dotnet46 dockerfile run windows application

RUN Wine/Windows Inside Docker! Autoclick, winetricks, Save-As, DotNet45, .NET46!

To install wine and winetricks inside a docker, you need a fake X display server for winetricks to finish installing.

dotnet46 dockerfile run windows application
dotnet46 dockerfile run windows application

The following code is the bare minimum, you need every line!

ENV TZ prevents a dialog from happening during the xfce installation.

ARG DEBIAN_FRONTEND=noninteractive prevents another dialog.

xfce4 is the desktop, it has just enough features for the xdotool to work.

We choose DISPLAY number :99

FROM ubuntu:18.04
WORKDIR /root
RUN apt update -y
RUN apt install wine-stable wine-development winetricks xdotool -y
RUN dpkg --add-architecture i386
RUN apt-get update && apt-get install wine32 -y
RUN apt install zenity -y
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get install keyboard-configuration -y
RUN apt install xfce4 xfce4-goodies -y
RUN apt install xvfb -y
RUN apt install winbind -y
ENV DISPLAY :99

WORKDIR /root
ADD display.sh display.sh
RUN chmod a+x display.sh

CMD { bash display.sh; }

Inside a file called display.sh. Note, Xfvb is case-sensitive.

export DISPLAY=:99
Xvfb :99 -screen 0 1000x1000x16 &
xrandr --query
sleep 5
nohup startxfce4 &
sleep 10
xdotool mousemove 493 539 click 1
xrandr --query
winetricks -q msxml4 msxml6 corefonts vcrun2010 vcrun2013 vcrun2017 dotnet46

Then run
docker build -t somelabel .
docker run -t somelabel

End result, a fully headless Wine DotNet46 installation!

You can interact with the Windows program using xdotool:

xdotool mousemove 493 539 click 1
sleep 5
xdotool key KP_Enter
sleep 5
xdotool key KP_Enter
sleep 5
xdotool key KP_Enter
sleep 5
xdotool key KP_Enter

Leave a Reply

Your email address will not be published. Required fields are marked *