Running RobotLab (Legacy Windows App) Remotely or Locally in a Docker Container Under Wine Via RDP

One of our longer running courses (TM129 — Technologies in practice) distributes a Windows desktop application (RobotLab) developed internally 15+ years ago that implements a simple 2D robot simulator.

For the last few years, we’ve been supposed to make software available on a cross platform basis. For Windows users, I think the application is recompiled every so often to cope with Windows OS upgrades, for Linux it’s distributed using Wine (I think?) and for Macs it’s bundled under PlayOnMac.

A recent issue with the Mac version prompted me to revisit my earlier attempt at producing a DIT4C Inspired RobotLab Container with a simple RDP container that a student could connect to via the Microsoft RDP (remote desktop protocol) client. (One advantage of RDP is that sound sort of works and the RobotLab activities includes one that involves sound…)

Here’s a minimal Dockerfile, derived from danielguerra69/ubuntu-xrdp:

FROM danielguerra/ubuntu-xrdp

#Required to add repo
RUN apt-get update && apt-get install -y software-properties-common

RUN dpkg --add-architecture i386

RUN wget -nc<

RUN apt-key add winehq.key

RUN apt-add-repository 'deb xenial main'

RUN apt update && apt-get install -y --install-recommends winehq-stable

COPY Apps/  /opt/

To build the Docker image, I put original Apps/ folder containing RobotLab and Neural folders in the same directory as the Dockerfile and then run:

docker build -t myimagetagname  .

The container then be run from that as:

docker run  --name mycontainername  --shm-size 1g -p MYMAPPEDPORT:3389 -d  myimagetagname

For reference, a version of the container can be found here — ousefulcoursecontainers/tm129rdp — and if you need an RDP client they can be found here. There's a repo here, but there are various experiments scattered across various branches and it's not very well documented / clear what's where and what's working yet and how…

If you have docker locally or remotely, the demo container can be run using:

docker run --name tm129 --hostname tm129demo --shm-size 1g -p 3391:3389 -d ousefulcoursecontainers/tm129rdp

(You should be able to run the container remotely on Digital Ocean. See here for a crib.)

In the RDP client application, create a new connection on port 3391 (or whatever you mapped in the docker run command)  as per:

Login with user: ubuntu

The password seems optional but is also: ubuntu

If you need to sudo using the terminal on the remote desktop, the password is: ubuntu

The RobotLab and Neural apps are in the /opt directory (a more recent build uses /opt/Apps, I think?).

When you first run the applications, wine wants to install several packages (gecko twice (?), mono once). (I made a start on trying to run the associated installers in the Dockerfile, but the approach I’be been taking so far doesn’t seem to work…)

#Use a base XRDP container
FROM danielguerra/ubuntu-xrdp

#Required to add a repo
RUN apt-get update && apt-get install -y software-properties-common

#Add additional repo required for wine install
RUN dpkg --add-architecture i386
RUN wget -nc
RUN apt-key add winehq.key
RUN apt-add-repository 'deb xenial main'
RUN apt update && apt-get install -y --install-recommends winehq-stable

#The first time wine is used it wants to download some bits...
#I've tried to to add via the Dockerfile but can't get it to work (yet?!) 
#Not sure these are the correct versions, either?
#RUN wget
#RUN wget
#RUN wget
#RUN wine msiexec /i wine_gecko-2.47-x86_64.msi
#RUN wine msiexec /i wine_gecko-2.47-x86.msi
#RUN wine msiexec /i wine-mono-4.8.1.msi

#Copy over the Windows applications we want to run under wine
COPY Apps/  /opt

#I can't seem to create a user or copy the files to that user home directory?
#If I do, I just get a black screen when I try to connect using RDP client on a Mac.

Files can be saved in RobotLab but you need to select My Documents within the wine context, the files ending up down a path:

I don’t know if there’s a way of configuring this so we can save files more directly  into the host filesystem rather than down the wine path? Would a symlink work?

If the container is halted and then restarted, any updates made to it will be immortalised in the container. So you don’t need to keep installing wine updates each time you want to use the container.

docker stop  --name tm129
docker start  --name tm129

I tried to make a cleaner build with tm129 user and the apps in a more convenient location, and then used a docker commit to make a new image, but the containers don’t seem to start up correctly from the new image.  I also tried tidying where the Apps folder was copied to, creating a tm129 user etc in the Dockerfile, but RDP didn’t seem to work thereafter (black screen on connect).

As far as to do items go, it would be nice to:

  1. create a tm129 user via the Dockerfile and install the applications to that user’s home directory;
  2. install the additional required wine packages via the Dockerfile;
  3. use a symlinked file path, or something, to make saving and loading files in the windows/wine apps a bit simpler.

If we can’t do the above as part of the build using the Dockerfile, find a way to update a container manually and then export a customised Docker image from it.

Nice to haves would be desktop icons pointing to the course applications. A demo of how to start a container that launches the RobotLab application on start (or an image that launches the remote desktop into one of the applications) could also be handy as a reference.

Author: Tony Hirst

I'm a Senior Lecturer at The Open University, with an interest in #opendata policy and practice, as well as general web tinkering...

%d bloggers like this: