diff --git a/docker-git/.footprint b/docker-git/.footprint new file mode 100644 index 000000000..c4e6f1d6e --- /dev/null +++ b/docker-git/.footprint @@ -0,0 +1,13 @@ +drwxr-xr-x root/root etc/ +-rw-r--r-- root/root etc/docker.conf +drwxr-xr-x root/root etc/rc.d/ +-rwxr-xr-x root/root etc/rc.d/docker +drwxr-xr-x root/root etc/udev/ +drwxr-xr-x root/root etc/udev/rules.d/ +-rw-r--r-- root/root etc/udev/rules.d/80-docker.rules +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/bin/ +-rwxr-xr-x root/root usr/bin/docker +drwxr-xr-x root/root usr/lib/ +drwxr-xr-x root/root usr/lib/docker/ +-rwxr-xr-x root/root usr/lib/docker/dockerinit diff --git a/docker-git/.md5sum b/docker-git/.md5sum new file mode 100644 index 000000000..afb9767b6 --- /dev/null +++ b/docker-git/.md5sum @@ -0,0 +1,2 @@ +966e1916d611427c44686ad09145996f docker.conf +dcaae2f852c97ba73436c77cda3eb4e3 docker.rc diff --git a/docker-git/.nostrip b/docker-git/.nostrip new file mode 100644 index 000000000..8d98f9deb --- /dev/null +++ b/docker-git/.nostrip @@ -0,0 +1 @@ +.* diff --git a/docker-git/Pkgfile b/docker-git/Pkgfile new file mode 100644 index 000000000..f0575d7d6 --- /dev/null +++ b/docker-git/Pkgfile @@ -0,0 +1,46 @@ +# Description: Pack, ship and run any application as a lightweight container +# URL: http://www.docker.io/ +# Maintainer: James Mills, prologic at shortcircuit dot net dot au +# Packager: Sébastien "Seblu" Luttringer +# +# Depends on: git go bridge-utils lxc sqlite3 + +name=docker-git +version=0.8.0-dev +revision=f5d028c838 +release=1 +source=( + docker.rc + docker.conf +) + +build() { + cd $PKGMK_SOURCE_DIR + if [ ! -d $name ]; then + git clone git://github.com/dotcloud/docker.git $name + else + cd $name + git pull --rebase + fi + cp -r $PKGMK_SOURCE_DIR/$name $SRC + + cd $SRC/$name + git checkout $revision + + # symlink vendor packages + mkdir -p vendor/src/github.com/dotcloud + ln -sfn ../../../../ vendor/src/github.com/dotcloud/docker + + # Build + export GOPATH="$(pwd):$(pwd)/vendor" + ./hack/make.sh dynbinary + + # Package + install -Dm755 "bundles/$version/dynbinary/docker-$version" "$PKG/usr/bin/docker" + install -Dm755 "bundles/$version/dynbinary/dockerinit-$version" "$PKG/usr/lib/docker/dockerinit" + install -Dm644 "contrib/udev/80-docker.rules" "$PKG/etc/udev/rules.d/80-docker.rules" + install -D -m 755 $SRC/docker.rc $PKG/etc/rc.d/docker + install -D -m 644 $SRC/docker.conf $PKG/etc/docker.conf + + chown -R root:root $PKG +} diff --git a/docker-git/README b/docker-git/README new file mode 100644 index 000000000..5f524a48f --- /dev/null +++ b/docker-git/README @@ -0,0 +1,81 @@ +Kernel Requirements +=================== + + +If you want to have a full working CRUX+Docker system you will need to rebuild your kernel with the following options enabled: + +Networking: + +- CONFIG_BRIDGE +- CONFIG_NETFILTER_XT_MATCH_ADDRTYPE +- CONFIG_NF_NAT +- CONFIG_NF_NAT_IPV4 +- CONFIG_NF_NAT_NEEDED + +LVM: + +- CONFIG_BLK_DEV_DM +- CONFIG_DM_THIN_PROVISIONING +- CONFIG_EXT4_FS + +Namespaces: +- CONFIG_NAMESPACES +- CONFIG_UTS_NS +- CONFIG_IPC_NS +- CONFIG_UID_NS +- CONFIG_PID_NS +- CONFIG_NET_NS + +Cgroups: + +- CONFIG_CGROUPS + +Cgroups Controllers (*optional but highly recommended*): + +- CONFIG_CGROUP_CPUACCT +- CONFIG_BLK_CGROUP +- CONFIG_MEMCG +- CONFIG_MEMCG_SWAP + +You may check your kernel configuration by running the provided ``test_kernel_config.sh`` script against your kernel configuration: + +:: + + ./test_kernel_config.sh /usr/src/linux/.config + + +Other Requirements +================== + + +You **must** have the following ``cgroup`` mount point mounted: + +:: + + none /cgroup cgroup defaults 0 0 + + +Storage Backends +================ + +Docker comes with three main Storage Backends: + +- AUFS (*requires AUFS kernel/patches*) +- devmapper +- btrfs + +It is recommended you use the devmapper or btrfs backend (Default: devmapper). + +To use the ``btrfs`` backend edit ``/etc/docker.conf`` and modify the ``DOCKER_OPTS`` with: + +:: + + DOCKER_OPTS="-s btrfs" + + +Docker Client +============= + +The provided Docker rc script changes the group ownership of the ``/var/run/socker.sock`` UNIX Socket to ``docker``. + +Add yourself to this group if you wish to access the Docker daemon on localhost via UNIX Socker. diff --git a/docker-git/docker.conf b/docker-git/docker.conf new file mode 100644 index 000000000..0b2644b95 --- /dev/null +++ b/docker-git/docker.conf @@ -0,0 +1,5 @@ +# Docker Daemon Configuration + +DOCKER_OPTS="-d -p /var/run/docker.pid -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock" + +# vim: syntax=sh diff --git a/docker-git/docker.rc b/docker-git/docker.rc new file mode 100755 index 000000000..4298b6bf3 --- /dev/null +++ b/docker-git/docker.rc @@ -0,0 +1,34 @@ +#!/bin/sh +# +# /etc/rc.d/docker: start/stop docker daemon +# + +source /etc/docker.conf + +case $1 in +start) + nohup /usr/bin/docker $DOCKER_OPTS &> /var/log/docker.log & + touch /var/run/docker.sock + chgrp docker /var/run/docker.sock + ;; +stop) + if [ -f /var/run/docker.pid ]; then + kill $(< /var/run/docker.pid) + rm -f /var/run/docker.pid + rm -f /var/run/docker.sock + else + killall -q /usr/bin/docker + rm -f /var/run/docker.sock + fi + ;; +restart) + $0 stop + sleep 2 + $0 start + ;; +*) + echo "usage: $0 [start|stop|restart]" + ;; +esac + +# End of file diff --git a/docker-git/post-install b/docker-git/post-install new file mode 100755 index 000000000..a75854dbf --- /dev/null +++ b/docker-git/post-install @@ -0,0 +1,4 @@ +#!/bin/bash + +# create docker group +getent group docker > /dev/null || groupadd -g 142 docker diff --git a/docker-git/test_kernel_config.sh b/docker-git/test_kernel_config.sh new file mode 100755 index 000000000..713df59ac --- /dev/null +++ b/docker-git/test_kernel_config.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# Script to check Kernel Config +# Options taken from: http://docs.docker.io/en/latest/installation/kernel/ +# +# USAGE: ./testconfig.sh [ /path/to/kernel/config ] + +if [[ $# -lt 1 ]]; then + if [[ -e /proc/config.gz ]]; then + CONFIG=$(mktemp) + zcat /proc/config.gz > $CONFIG + else + echo "Usage: $self [ /path/to/kernel/config ]" + exit 1 + fi +else + CONFIG=${1} +fi + +echo "Checking Networking:" +egrep "CONFIG_BRIDGE=.$" $CONFIG +egrep "CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=.$" $CONFIG +egrep "CONFIG_NF_NAT=.$" $CONFIG +egrep "CONFIG_NF_NAT_IPV4=.$" $CONFIG +egrep "CONFIG_NF_NAT_NEEDED=.$" $CONFIG +echo + +echo "Checking LVM:" +egrep CONFIG_BLK_DEV_DM $CONFIG +egrep CONFIG_DM_THIN_PROVISIONING $CONFIG +egrep CONFIG_EXT4_FS $CONFIG +echo + +echo "Checking Namespaces:" +egrep CONFIG_NAMESPACES $CONFIG +egrep CONFIG_UTS_NS $CONFIG +egrep CONFIG_IPC_NS $CONFIG +egrep CONFIG_UID_NS $CONFIG +egrep CONFIG_PID_NS $CONFIG +egrep CONFIG_NET_NS $CONFIG +echo + +echo "Checking Cgroups:" +egrep CONFIG_CGROUPS $CONFIG +echo + +echo "Checkin gCgroup controllers (optional but highly recommended):" +egrep CONFIG_CGROUP_CPUACCT $CONFIG +egrep CONFIG_BLK_CGROUP $CONFIG +egrep CONFIG_MEMCG $CONFIG +egrep CONFIG_MEMCG_SWAP $CONFIG +echo + +echo "Running lxc-checkconfig:" +CONFIG=$CONFIG /usr/bin/lxc-checkconfig