Using docker to run silverlight applications on Ubuntu

The (online) bookkeeping software used by my accountant uses Silverlight. If you want to run this on ubuntu, there some steps involved.

First of all, you can't run silverlight in Google Chrome. The preferred way to run Silverlight on ubuntu is using pipelight and the plugin API it uses (NPAPI) is no longer supported by Google Chrome. This means you'll have to use firefox or some other browser supporting the NPAPI. I chose midori - a simple, webkit based browser.

Secondly, pipelight has quite some dependencies, including wine. This means your system will get polluted with all kinds of new packages and repositories that you only need for a single application.

I chose to run this in a docker container. GUI applications can actually be run quite easily in docker by forwarding the X11 socket, it's as simple as specifying

-v /tmp/.X11-unix:/tmp/.X11-unix

when starting docker.

The entire docker file looks as follows:

### Build using:
### docker build -t silverlight-base .
### Start using
### docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix rlz
### Since this will always start by installing wine and initializing the plugin stuff, you may want to commit the first changes (docker commit)
FROM ubuntu:14.04 RUN apt-get install -y --no-install-recommends software-properties-common
RUN apt-add-repository multiverse
RUN add-apt-repository ppa:pipelight/stable RUN dpkg --add-architecture i386 && apt-get update
RUN apt-get update # RUN dpkg-divert --local --rename --add /sbin/initctl && ln -s /bin/true /sbin/initctl
# RUN apt-get install -y --no-install-recommends xpra xdm libxrandr2 ssh
RUN localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 || :
RUN apt-get install -y --force-yes pipelight-multi
RUN yes | pipelight-plugin --enable silverlight RUN apt-get install -y midori
# Replace 1000 with your user / group id
RUN export uid=1000 gid=1000 && \
mkdir -p /home/developer && \
echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
echo "developer:x:${uid}:" >> /etc/group && \
echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
chmod 0440 /etc/sudoers.d/developer && \
chown ${uid}:${gid} -R /home/developer USER developer
ENV HOME /home/developer
CMD /usr/bin/midori

A simple start script will start everything you need:

docker run -ti -v /tmp/.X11-unix:/tmp/.X11-unix reeleezee


Last updated Feb. 22, 2015, 9:32 a.m. | filed under ubuntu | docker silverlight ubuntu pipelight chrome midori
comments powered by Disqus