Added docker-git (NEW): Pack, ship and run any application as a lightweight container

--HG--
extra : rebase_source : 72290899350bcddf632b3e03c3356784c961b9a9
This commit is contained in:
James Mills 2014-02-12 01:24:33 +10:00
parent 3f0e476779
commit 5b115c698f
9 changed files with 241 additions and 0 deletions

13
docker-git/.footprint Normal file
View File

@ -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

2
docker-git/.md5sum Normal file
View File

@ -0,0 +1,2 @@
966e1916d611427c44686ad09145996f docker.conf
dcaae2f852c97ba73436c77cda3eb4e3 docker.rc

1
docker-git/.nostrip Normal file
View File

@ -0,0 +1 @@
.*

46
docker-git/Pkgfile Normal file
View File

@ -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
}

81
docker-git/README Normal file
View File

@ -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.

5
docker-git/docker.conf Normal file
View File

@ -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

34
docker-git/docker.rc Executable file
View File

@ -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

4
docker-git/post-install Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
# create docker group
getent group docker > /dev/null || groupadd -g 142 docker

View File

@ -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