Skip to content

Testing different distros using Docker containers

miffedmap edited this page Feb 6, 2015 · 4 revisions

Why Docker?

Testing Across multiple distros can be tricky, especially since most of us use only a single distro regularly. Docker containers enable developers to quickly setup an isolated testing environment that is (for most purposes) equivalent to installing a different distro, e.g. you can create a Fedora environment on your Debian system, or a Mint environment inside Ubuntu, etc'.

What will we do with docker?

Assuming docker is available, the steps below explain how to:

  1. Create a Fedora 21/64bit Docker container (I used Fedora as the Host as well, but that's not required).
  2. Install required dependencies inside the container.
  3. Run LNP/df and check that everything works.

With minor tweaks, this procedure should work on any distro you have installed. Docker images are now readily available for most major distros from the Docker Hub.

Relevent SO Questions:

Procedure

Note: Some steps included have security implications and may open your system to attack. You should understand what you're doing before you do it.

On host :

Pull the fedora 21 image:

$ docker pull fedora:21 

Open up XServer access from the container (and the whole world - Dangerous!):

$ sudo xhost +

Launch fedora container and run bash inside. Running as privileged container is required on Fedora because of SELinux (see SO above). We map The LNP directory inside the container (at /LNP) and map in the XServer unix socker so we can run GUI apps from inside the container:

$ docker run --privileged=true  -t -i --name f21-df -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v <PATH_TO_LNP_DIR_ON_HOST>:/LNP fedora:21 /bin/bash 

You should now see a shell which is running inside a container named f21-df, which contains a minimal image of a Fedora 21 System.

Inside container shell:

$ export DISPLAY=:0   # We'll use the host XServer
$ export QT_X11_NO_MITSHM=1 # fix errors from Dwarf Therapist

These deps were enough to get df, dfhack, the pyLNP GUI and DT to run but they may be incomplete.

$ yum install -y SDL.i686 SDL_image.i686 SDL_ttf.i686 mesa-libGLU.i686 gtk2.i686 zlib.i686 openal-soft.i686 xterm python qt qt-x11 bzip2 xorg-x11-fonts-Type1

Launch df (or dfhack or LNP) (df may crash the first time it's run, 2nd time should work):

$ cd /LNP/pack/df_linux
$ ./df