Docker on Debian Wheezy
Maybe you have already heard of the next revolution in application deployment called Docker. I quote:
Docker is an open-source engine which automates the deployment of applications as highly portable, self-sufficient containers which are independent of hardware, language, framework, packaging system and hosting provider.
On the getting started page, you can see that you need an Ubuntu machine to get it running:
- Ubuntu 12.04 (LTS) (64-bit)
- or Ubuntu 12.10 (quantal) (64-bit)
- The 3.8 Linux Kernel
One thing that is missing from this list, is AUFS support in the kernel, which isn’t a sure thing these days in Ubuntu.
However, I was interested in running Docker on a 64-bit Debian Wheezy machine, and this post explains how to do it. It’s not really hard, but you need to install an Ubuntu kernel. At least, I haven’t been able to find a 3.8 kernel for Wheezy just yet.
Your best bet is the 3.8 kernel from Ubuntu 13.04 Raring, backported for Ubuntu 12.04 LTS Precise. If that link is broken, try this one or get the right page from here. I have tried a kernel from Ubuntu’s mainline kernel PPA, but the 3.8 and 3.9 kernels for Raring from there seem to lack AUFS support.
I downloaded the deb named linux-image-3.8.0-23-generic_3.8.0-23.34~precise1_amd64.deb, which installs on Wheezy without problems. Just do:
$ sudo dpkg -i linux-image-3.8.0-23-generic_3.8.0-23.34~precise1_amd64.deb $ sudo reboot
Now find a Docker package on Launchpad. Get the one that is built for Precise.
First install the dependencies:
$ sudo apt-get install lxc bsdtar
and then Docker. This will not succeed:
$ sudo dpkg -i lxc-docker_0.4.0-1_amd64.deb Selecting previously unselected package lxc-docker. (Reading database ... 40929 files and directories currently installed.) Unpacking lxc-docker (from lxc-docker_0.4.0-1_amd64.deb) ... Setting up lxc-docker (0.4.0-1) ... /var/lib/dpkg/info/lxc-docker.postinst: 4: /var/lib/dpkg/info/lxc-docker.postinst: /sbin/start: not found dpkg: error processing lxc-docker (--install): subprocess installed post-installation script returned error exit status 127 Errors were encountered while processing: lxc-docker
This is caused by Docker’s Ubuntu package trying to use upstart to start the daemon, which does not work on Debian. Disable that:
sed -i 's~/sbin/start~#/sbin/start~' /var/lib/dpkg/info/lxc-docker.postinst sed -i 's~/sbin/stop~#/sbin/stop~' /var/lib/dpkg/info/lxc-docker.prerm
If you now have apt-get fix its state, it should work:
$ sudo apt-get -f install Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Setting up lxc-docker (0.4.0-1) ...
Now continue with the examples on Docker’s website. Happy Docker’ing!