|
| 1 | +--- |
| 2 | +title: "Dolmades: Windows Apps under Linux using Singularity" |
| 3 | +category: recipes |
| 4 | +permalink: dolmades-windows-containers |
| 5 | +--- |
| 6 | + |
| 7 | +## Introduction |
| 8 | +Recently I've found several reasons why Windows containers fit in nicely in our Linux-dominated environments: |
| 9 | + |
| 10 | +- You actually do have <a href="https://github.com/CHPC-UofU/Singularity-ubuntu-wine-peakselector" target="_blank"> a scientific application</a> which is exclusively available for windows |
| 11 | +- How about installing and running MS Office inside a safe environment? |
| 12 | +- Do you own Windows games you always wanted to play under Linux? |
| 13 | +- Your tax reporting software runs under Windows only? |
| 14 | + |
| 15 | +That's why I initiated a project called <a href="http://dolmades.org" target="_blank">dolmades</a> which should bring portable and sustainable windows applications to linux users. |
| 16 | +Its goal is to provide stable recipes for people who are interested in regularily using one or only a few particular windows application. |
| 17 | +For that purpose VMs and dual-booting bear a huge overhead in both performance and ressources. |
| 18 | +Another approach is to use <a href="https://winehq.org" target="_blank">wine</a>, a wrapper that redirects Windows system calls into native Linux system calls and allows execution of native Windows binaries under supported platforms (Unix with X, just recently Android). |
| 19 | + |
| 20 | +So, why don't we formulate the following equation: wine + singularity = dolmades ? |
| 21 | + |
| 22 | + |
| 23 | +## About |
| 24 | +This document describes how to get a dolmade running in which one or several windows apps can be installed temporarily or permanently. |
| 25 | +Both a Singularity Hub and a Docker Hub image template is readily available and supports plenty of win apps already without further modification needed. |
| 26 | + |
| 27 | +## Requirements |
| 28 | +This tutorial uses singularity 2.3 which is all what you will need to have installed. |
| 29 | +The game which is being installed is freely downloadable. |
| 30 | +Normal user privileges will suffice provided you install your software into the proper location. |
| 31 | + |
| 32 | +## Example Dolmade |
| 33 | +Let's pull the dolmades docker image. Alternatively, you can use the shub image. |
| 34 | + |
| 35 | +``` |
| 36 | +singularity pull docker://c1t4r/dolmades |
| 37 | +``` |
| 38 | + |
| 39 | +This image comes with Ubuntu 16.04 and has the winehq PPA enabled. |
| 40 | +It has wine version 2.0.1 (current stable) installed and some additional packages which are needed |
| 41 | +to run some DX9 games. |
| 42 | + |
| 43 | +Now, extend the size of the image and execute its run script in read-write mode: |
| 44 | + |
| 45 | +``` |
| 46 | +singularity expand -s 1500 dolmades.img |
| 47 | +singularity exec -w dolmades.img /singularity |
| 48 | +``` |
| 49 | + |
| 50 | +This will do the following in ```/tmp```: |
| 51 | + |
| 52 | +1. Check if a wine prefix exists from a previous run? If yes: restore it, if no: initialize it. |
| 53 | + The wine prefix is kind of a chroot location for wine apps and where the windows user profiles and their apps are being stored. |
| 54 | +2. Download and install DirectX9 |
| 55 | +3. Start a new shell |
| 56 | +4. Prints the instructions to manually download and install Broken Sword 2.5 (a nice, free adventure game) |
| 57 | +5. After you are done, test it and finally exit the shell. |
| 58 | +6. The profile will be saved under `/PROFILES`, the game under `/APPS`. |
| 59 | + |
| 60 | +***NOTE:*** it is important to call the EXE from its directory or else it will fail! |
| 61 | + |
| 62 | +``` |
| 63 | +wine ./bsengine.exe |
| 64 | +``` |
| 65 | + |
| 66 | +Expand the size of your container further or use a new one to try out other windows games or apps! |
| 67 | + |
| 68 | +If you are unsure if an app will install or work properly you can test that without modifying the container. |
| 69 | +Simply start it read-only: |
| 70 | + |
| 71 | +``` |
| 72 | +./dolmades.img # or singularity run dolmades.img |
| 73 | +``` |
| 74 | + |
| 75 | +Once you have figured out how to install and make an app work you repeat the steps in rw-mode. |
| 76 | +Often, some registry entries need to be tweaked or some builtin DLLs substituted by native ones. |
| 77 | + |
| 78 | +That can be often done using the tool `winetricks`. Some more settings can be tweaked using the tool ```winecfg```. |
| 79 | + |
| 80 | +## Resources |
| 81 | + |
| 82 | +This is the ```Dockerfile``` to build the dolmades docker image |
| 83 | +{% include gist.html username='katakombi' id='6ce5690804beefaeb83abe2f3c946b08' file='Dockerfile' %} |
| 84 | + |
| 85 | +This is the <a href="https://raw.githubusercontent.com/katakombi/dolmades/master/Singularity" target="_blank">link</a> to the singularity hub dolmades build spec file which also contains the run script. |
| 86 | + |
| 87 | +Dolmades are still in the early stages and there are many challenges to tackle before we seize the potential over using wine on Linux systems directly. |
| 88 | +If this speaks to you then send me your feedback or questions, and check my <a href="http://dolmades.org">project page</a> for screen shots of further examples. |
0 commit comments