Install Docker on Debian

Snipet to build a Linux kernel with AUFS support.

#!/bin/bash

VERSION=3.14
apt-get -y install git build-essential libncurses5-dev

git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux.git
pushd linux.git
git checkout -b v$VERSION tags/v$VERSION
popd

git clone git://git.code.sf.net/p/aufs/aufs3-standalone aufs3-standalone.git
pushd aufs3-standalone.git
git checkout -b aufs$VERSION remotes/origin/aufs$VERSION
popd

pushd linux.git
patch -p1  < ../aufs3-standalone.git/aufs3-kbuild.patch
patch -p1  < ../aufs3-standalone.git/aufs3-base.patch
patch -p1  < ../aufs3-standalone.git/aufs3-mmap.patch
patch -p1  < ../aufs3-standalone.git/aufs3-standalone.patch

cp -r ../aufs3-standalone.git/Documentation .
cp -r ../aufs3-standalone.git/fs .
cp -r ../aufs3-standalone.git/include/uapi/linux/aufs_type.h include/uapi/linux/
popd

At this point we must configure the Kernel. Keep in mind that CGroup is activated and AUFS Filesystem:

pushd linux.git
make menuconfig
make all -j8
mkdir ../kernel-$VERSION
cp ./arch/x86_64/boot/bzImage System.map ../kernel-$VERSION/
popd

The next step is to boot with this kernel:

cp ../kernel-3.12/bzImage /boot/bzImage-3.14.6-64
cp ../kernel-3.12/System.map /boot/System.map-3.14.6-64

update-grub
#Generating grub.cfg ...
#Found linux image: /boot/bzImage-3.14.6-64
#Found Debian GNU/Linux (7.2) on /dev/sda1
#done

reboot

Install docker:

echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
wget -qO- https://get.docker.io/gpg | apt-key add -
apt-get update
apt-get -y install lxc-docker

Check if the enviroment setup is compatible with lxc:

lxc-checkconfig
--- Namespaces ---
 Namespaces: enabled
 Utsname namespace: enabled
 Ipc namespace: enabled
 Pid namespace: enabled
 User namespace: enabled
 Network namespace: enabled
 Multiple /dev/pts instances: enabled
--- Control groups ---
 Cgroup: enabled
 Cgroup clone_children flag: enabled
 Cgroup device: enabled
 Cgroup sched: enabled
 Cgroup cpu account: enabled
 Cgroup memory controller: missing
 Cgroup cpuset: enabled
--- Misc ---
 Veth pair device: enabled
 Macvlan: enabled
 Vlan: enabled
 File capabilities: enabled
Note : Before booting a new kernel, you can check its configuration
 usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig

Add the current user to docker group

adduser $USER docker

To verify the installation run the following command:

docker run -i -t ubuntu /bin/bash

now you are in a ubuntu-docked shell 🙂

Useful urls:

This entry was posted in Debian, General, Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *