Monday, 20 June 2016

Building Docker for Slackware 14.1

I was learning Docker; and  a quick way to get started was to use Ubuntu to install and run Docker. Since I already had Slackware installed, I had to install Ubuntu into a Qemu/KVM virtual machine.

And it worked well while I was at home with my Acer AspireF15 tethered to the Internet gateway via copper LAN. This is because I have yet to figure out how to get qemu running over my WiFi connection. When travelling, I needed to have my AspireF15 host Docker directly. This meant a Slackware installation of Docker, which is not directly supported.

A good place to look would be the SlackBuild docker repository. It requires you to install the Google Go language first. It is really quite simple. You download the two zipfiles and unpack them:

tar -xvpf google-go-lang.tar.gz

This generates a sub-directory google-go-lang. Just go in there, and copy the other zipfile (go1.4.3.src.tar.gz) over. Then log in as root, and run the SlackBuild:


It should generate a tgz file like this one:


And you just install it in your Slackware 14.1 thus:

upgradepkg --install-new /tmp/google-go-lang-1.4.3-x86_64-1_SBo.tgz

Now for Docker proper and you might have guessed:
tar -xvpf docker.tar.gz
cp -a ../docker-1.8.2.tar.gz .
upgradepkg --install-new /tmp/docker-1.8.2-x86_64-1_SBo.tgz

You start Docker with the script rc.docker:
/etc/rc.d/rc.docker start

And it responds with:
starting docker ...

You then test docker with (first make sure you are connected to the Internet):
docker run hello-world

I would expect docker to barf, and if you looked in its log file:
 cat /var/log/docker.log

You might get something like:

time="2016-06-13T17:54:15.002086000+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: Error running DeviceCreate (CreatePool) dm_task_run failed"

This is because Slackware 14.1 uses the 3.10.17 Linux kernel, and you need a recent kernel to run Docker. I went for the latest stable version of Linux, 4.6.2 as even 4.4.13 in the current version of Slackware was not good enough.

So all we need is to recompile the latest kernel, which should be a doddle in Slackware. Warning: the following steps can result in a non-bootable computer. If done on a smartphone or tablet it can brick your device. 

Download your kernel from into your /usr/src/ directory. Unpack it the usual way:
tar -xvpf linux-4.6.2.tar.xz

Remove the symbolic link to your old kernel:
rm -r linux

And set the new version:

ln -s /home/heong/Linux/linux-4.6.2 linux

Now you need your Slackware DVD's kernel config file (mind the '.' in config):

mount -t iso9660 /dev/dvd /mnt/dvd
cp /mnt/dvd/kernels/huge.s linux/.config

Now jump into your linux directory:
cd linux/
make oldconfig

A whole bunch of options comes up. You are encouraged to read through them, but it is quite safe to use the default settings. After 20 years of Slackware kernel compiles, I usually hold down the 'Enter' key until the program finishes.

The for the big moment:
make -j 10 bzImage

And when that succeeds,
make -j 10 modules

make modules_install
Now you need to tell the Slackware loader to use the new kernel.

cp .config /boot/config
cp /boot/
cp -a arch/x86/boot/bzImage /boot/

Next you edit /etc/lilo.conf and add the following lines at the bottom:
image = /boot/bzImage
root = /dev/sda3
label = docker

Save and exit, and run liloconfig:


Be sure to select 'expert  Use expert lilo.conf setup menu', and later, the 'Recycle  Reinstall LILO using the existing lilo.conf'

When that finishes, unmount the Slackware dvd:
umount /mnt/dvd

Pop it out of the dvd tray, and reboot your computer. At the boot screen, select your new kernel 'docker'. Log in as root, and re-run the Docker script:

/etc/rc.d/rc.docker start

Test your docker:
docker run hello-world

Which should now reply:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
f9d83caeda74: Pull complete 
2cc48731dfff: Pull complete 
Digest: sha256:ff215bfe287b986dba232bc82892d636b0e1b1c1ae42f779202caced61f6376b
Status: Downloaded newer image for hello-world:latest

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:

For more examples and ideas, visit:

Happy slacking, and see you around the docker hub.

No comments:

Post a Comment