commit 9355a877a68c0118178d22884babcfa8f06abc6c Author: James Mills <prologic@shortcircuit.net.au> Date: Sat Nov 22 10:28:51 2014 +1000 docker: Improved rc script and default configuration diff --git a/docker/.md5sum b/docker/.md5sum index ff59825..b30f276 100644 --- a/docker/.md5sum +++ b/docker/.md5sum @@ -1,4 +1,4 @@ d5e8ec779bb6e49cc6a44781f85d98b7 check-config.sh -966e1916d611427c44686ad09145996f docker.conf -139afe9c85732d52148035d62810b938 docker.rc +849b268387b3a23ce4e0b0bdf0c342d4 docker +5a4c44dc046f863f60bba02080d66fd1 docker.conf 098c366f9c8eb82ba537b93eec66303e v1.3.1.tar.gz diff --git a/docker/Pkgfile b/docker/Pkgfile index 8cc1a30..282ba18 100644 --- a/docker/Pkgfile +++ b/docker/Pkgfile @@ -1,5 +1,5 @@ # Description: Pack, ship and run any application as a lightweight container -# URL: http://www.docker.io/ +# URL: http://www.docker.com/ # Maintainer: James Mills, prologic at shortcircuit dot net dot au # # Depends on: go sqlite3 cgroupfs-mount @@ -7,11 +7,11 @@ name=docker version=1.3.1 revision=4e9bbfa900 -release=1 +release=2 source=( https://raw.githubusercontent.com/dotcloud/docker/v${version}/contrib/check-config.sh https://github.com/dotcloud/$name/archive/v$version.tar.gz - $name.rc + $name $name.conf ) @@ -35,7 +35,7 @@ build() { install -D -m 644 "contrib/udev/80-docker.rules" \ "$PKG/etc/udev/rules.d/80-docker.rules" - install -D -m 755 $SRC/$name.rc $PKG/etc/rc.d/$name + install -D -m 755 $SRC/$name $PKG/etc/rc.d/$name install -D -m 644 $SRC/$name.conf $PKG/etc/$name.conf chown -R root:root $PKG diff --git a/docker/docker b/docker/docker new file mode 100755 index 0000000..92fbbe9 --- /dev/null +++ b/docker/docker @@ -0,0 +1,45 @@ +#!/bin/sh +# +# /etc/rc.d/docker: start/stop docker daemon +# + +export PATH="/sbin:/usr/sbin:$PATH" + +source /etc/docker.conf + +case $1 in +start) + # Ensure ownership and permissiong of log file. + touch /var/log/docker.log + chgrp docker /var/log/docker.log + chown 640 /var/log/docker.log + + # Ensure cgroups is properly mounted. + cgroupfs-mount + + nohup /usr/bin/docker $DOCKER_OPTS > /var/log/docker.log 2>&1 & + ;; +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 + + # Unmount cgroups is + cgroupfs-umount + ;; +restart) + $0 stop + sleep 2 + $0 start + ;; +*) + echo "usage: $0 [start|stop|restart]" + ;; +esac + +# End of file diff --git a/docker/docker.conf b/docker/docker.conf index 0b2644b..383629d 100644 --- a/docker/docker.conf +++ b/docker/docker.conf @@ -1,5 +1,7 @@ # Docker Daemon Configuration +# +# For configuration options see: docker --help -DOCKER_OPTS="-d -p /var/run/docker.pid -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock" +DOCKER_OPTS="-d -p /var/run/docker.pid" # vim: syntax=sh diff --git a/docker/docker.rc b/docker/docker.rc deleted file mode 100755 index 3f24d6f..0000000 --- a/docker/docker.rc +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# -# /etc/rc.d/docker: start/stop docker daemon -# - -source /etc/docker.conf - -case $1 in -start) - # Ensure ownership and permissiong of log file. - touch /var/log/docker.log - chgrp docker /var/log/docker.log - chown 640 /var/log/docker.log - - # Ensure cgroups is properly mounted. - cgroupfs-mount - - nohup /usr/bin/docker $DOCKER_OPTS > /var/log/docker.log 2>&1 & - ;; -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 - - # Unmount cgroups is - cgroupfs-umount - ;; -restart) - $0 stop - sleep 2 - $0 start - ;; -*) - echo "usage: $0 [start|stop|restart]" - ;; -esac - -# End of file