Isolated MediaWiki Setup on the Raspberry Pi using Docker, Part 1

4 min read

This blog series shows you how to use Docker on the favorite Raspberry Pi distribution, Raspbian, to get MediaWiki set up and running.

Raspberry Pi is a great little platform for hardware experimentation. Docker is a virtualization platform that runs Linux containers instead of VM images, and thus is small and fast – just the right size and speed for a Raspberry Pi.

Combining the two is great for throw-away experiments and application setups consisting of multiple parts that are better kept apart (“multi-tier” applications). Whereas without Docker, these experiments and setups would require a complete re-installation of the operating system before and/or after each experiment, with Docker, each experiment starts from a pristine state every time.

What you need

It does not take much to follow along:

  • A Raspberry Pi, Model B or B+ and some accessories:
  • Ethernet cable
  • USB cable (attached to a 5V power source)
  • An SD card (at least 2 GB are required for the steps shown here) and a device to write to it
  • An Internet connection accessible via Ethernet, such as your Wi-Fi router

Raspbian with Docker

A Raspberry Pi runs its operating system from its SD card. Usually, this is provided as a big image file that must be downloaded upfront, but the wonderful raspbian-ua-netinst project provides an alternative, where a small up-front image download makes the Raspberry Pi automatically download and install an up-to-date Raspbian system.

I’ve forked the net installer to include Docker 1.2.0 so it is ready to go after the unattended installation. You can download a pre-built image file from here, or build the image manually in the following section.

Build the image file manually

The source code is available on GitHub. If you have Docker and Git (and Bash) installed on your computer, you can build the image using the following code:

 git clone
   cd raspbian-ua-netinst
   git checkout packt
   tar -xf raspbian-ua-netinst-output.tar

The image is in raspbian-ua-netinst-output/, and the various formats are equivalent.

How to put the image on the SD card

The Raspberry Pi Documentation website has fine guides on how to write the image to an SD card. It boils down to something like the following (on Linux):

   lsblk # find the device
   bzcat raspbian-ua-netinst*.img.bz2 > /dev/mmcblk0

Of course, be very careful that you target the right device and that it does not contain any valuable data, as this command will erase everything.


Once you have the image on the card, plug it into your Raspberry Pi, attach the Ethernet cable, and power it up by plugging in the USB cable.

If all goes well, you will have a small working Raspbian distribution about 20 to 25 minutes later. (These were the times I observed on a 10 MBit/s connection.)

Where is my Pi?

To find the address of your Raspberry Pi, you can run nmap:

   sudo nmap -sn | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'

In this command, you might have to change the part, which describes the network to scan. The awk command will then print the IP address that belongs to a Raspberry Pi MAC address, as all Raspberry Pi MACs start with the vendor identification B8:27:EB.

Log in to the Raspberry Pi

Using the address found above now allows you to log into the Raspberry Pi:

   ssh -l root <ip_of_raspberry_pi>
   # Password: raspbian

Once you’ve reached the [email protected]:~# prompt, enter the Docker version to validate that the Docker client and server are running properly. This should give you something like the following output:

[email protected]:~# docker version
   Client version: 1.2.0
   Client API version: 1.14
   Go version (client): go1.3.1
   Git commit (client): fa7b24f
   OS/Arch (client): linux/arm
   Server version: 1.2.0
   Server API version: 1.14
   Go version (server): go1.3.1
   Git commit (server): fa7b24f

By the way, if you ever want to properly shut down the Raspberry Pi, you can do so by using:

   systemctl powerof

Don’t do it now though, since we are not done yet!


Now that we have Docker working on our Raspberry Pi, let’s see what we can do with it in Part 2.

Want more Docker content? Find more tutorials and insight on our dedicated page

About the author

Felix Rabe has been programming and working with different technologies and companies at different levels since 1993. Currently he is researching and promoting Named Data Networking, an evolution of the Internet architecture that currently relies on the host-bound Internet Protocol.


Please enter your comment!
Please enter your name here