Okay, so here’s another way of trying to run legacy Windows applications under Wine in a Docker container via browser.
This variant improves on Running RobotLab (Legacy Windows App) Remotely or Locally in a Docker Container Under Wine Via RDP by not requiring the user to update Wine and by launching directly into either the RobotLab application or the Neural application.
If you have Docker running, you should be able to just type:
#Run RobotLab (default) docker run --name tm129robotlab --shm-size 1g -p 3395:10000 -d ousefuldemos/tm129robotics-xpra-html5 #Run RobotLab (explicitly) docker run --name tm129robotlabx --shm-size 1g -p 3396:10000 -e start=robotlab -d ousefuldemos/tm129robotics-xpra-html5 #Run Neural (explicitly) docker run --name tm129neuralx --shm-size 1g -p 3397:10000 -e start=neural -d ousefuldemos/tm129robotics-xpra-html5
Here’s the Dockerfile (also see the repo):
#This container has been removed #and the original repo archived (it used an old Linux base container) #FROM lanrat/docker-xpra-html5 #I forked the lanrat/docker-xpra-html5 and rebuilt it using ubuntu:bionic #https://github.com/ouseful-backup/docker-xpra-html5 FROM ousefuldemos/docker-xpra-html5 USER root #Required to add repo RUN apt-get update && apt-get install -y software-properties-common wget #Install wine RUN dpkg --add-architecture i386 RUN wget -qO- https://dl.winehq.org/wine-builds/winehq.key | apt-key add - RUN apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' RUN apt update && apt-get install -y --install-recommends winehq-stable #Install the wine packages wine wants to load if they aren't already there #There are lots of warnings in the install but they seem to work in use? RUN mkdir -p /home/user/.cache/wine RUN wget http://dl.winehq.org/wine/wine-mono/4.8.1/wine-mono-4.8.1.msi -O /home/user/.cache/wine/wine-mono-4.8.1.msi RUN wget http://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86.msi -O /home/user/.cache/wine/wine_gecko-2.47-x86.msi RUN wget http://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86_64.msi -O /home/user/.cache/wine/wine_gecko-2.47-x86_64.msi USER user RUN wine msiexec /i /home/user/.cache/wine/wine_gecko-2.47-x86_64.msi RUN wine msiexec /i /home/user/.cache/wine/wine_gecko-2.47-x86.msi RUN wine msiexec /i /home/user/.cache/wine/wine-mono-4.8.1.msi USER root #Use the recipe in https://blog.ouseful.info/2019/03/11/running-microsoft-vs-code-remotely-xpra-and-rdp/ #for starting with RobotLab #Copy over Win application folders COPY Apps/ /opt/Apps #Add some start commands ADD robotlab.sh /usr/local/bin/robotlab RUN chmod +x /usr/local/bin/robotlab ADD neural.sh /usr/local/bin/neural RUN chmod +x /usr/local/bin/neural #Pulseaudio also has a switch in cmd #Can't get this working atm... #Does it even make sense to try? #i.e. can XPRA HTML be used to play audio in a browser anyway? #RUN apt-get install -y pulseaudio #Go back to user... USER user ENV start robotlab #Start with robotlab CMD xpra start --bind-tcp=0.0.0.0:10000 --html=on --exit-with-children --daemon=no --xvfb="/usr/bin/Xvfb +extension Composite -screen 0 1920x1080x24+32 -nolisten tcp -noreset" --pulseaudio=no --notifications=no --bell=no --start-child=${start} #Example image pushed as #docker build -t ousefuldemos/tm129robotics-xpra-html5 . #Default runs robotlab #docker run --name tm129x --shm-size 1g -p 3395:10000 -d ousefuldemos/tm129robotics-xpra-html5 #docker run --name tm129x --shm-size 1g -p 3395:10000 -e start=robotlab -d ousefuldemos/tm129robotics-xpra-html5
One thing I’s started wondering now is: could we run this via a Jupyter notebook UI using jupyter-server-proxy
(I tried, and it doesn’t seem to work atm: the proxy just goes into an infinite redirect loop?); or launch it as a standalone container using JupyterHub Dockerspawner and a Dockerfile shim to change the start CMD
so things start on port 8888 (a naive attempt at that didn’t seem to work either).
At the very least, this seems to offer a reasonably natural way of launching a containerised desktop application directly into the browser?
(It would be useful to know if PulseAudio can be used to play sound from a container launched on something like Digital Ocean through the XPRA HTML5 desktop viewed in a browser before I waste any more time chasing that, and if so, it would be really handy to see a minimal working example Dockerfile ;-)
I’m guessing it should also work in the Google Cloud Run serverless container context [howto]? I still need to try this out…