To install wine and winetricks inside a docker, you need a fake X display server for winetricks to finish installing.
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
[code]
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; }
[/code]
Inside a file called display.sh. Note, Xfvb is case-sensitive.
[code]
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
[/code]
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:
[code]
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
[/code]
Hello,
I want to run Windows applications on my office computer which is a Mac. May I know if this Dockerfile could work on MacOS? Running the Docker container gave “Can’t open display :99” “nohup: appending output to ‘nohup.out'”.
Thanks.
This runs heedlessly, you can’t actually see the screen. It’s for auto-clicking wine apps inside the container.
I could write a tutorial using the x11 method.
I love the Mac running in Docker on Ubuntu. I wonder if Windows could be run in Docker on Ubuntu as well.