aboutsummaryrefslogtreecommitdiff
path: root/system/docker/config
diff options
context:
space:
mode:
authorVincent Batts <vbatts@hashbangbash.com>2014-01-30 13:13:54 -0600
committerErik Hanson <erik@slackbuilds.org>2014-02-08 11:09:51 -0600
commitf1e2b846410cb6fc34da5f3ce4b85dc035810eb3 (patch)
tree8ba3233a0e734b21498d7f967e4e82afdf557c6a /system/docker/config
parent3059f8abc4dcd52c9b2c3f702505b51b83517ab5 (diff)
system/docker: Added (manager for applications in linux containers)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'system/docker/config')
-rw-r--r--system/docker/config/docker.default3
-rw-r--r--system/docker/config/docker.logrotate8
-rw-r--r--system/docker/config/rc.docker80
3 files changed, 91 insertions, 0 deletions
diff --git a/system/docker/config/docker.default b/system/docker/config/docker.default
new file mode 100644
index 000000000000..ae2989490d56
--- /dev/null
+++ b/system/docker/config/docker.default
@@ -0,0 +1,3 @@
+## Set defaults used by the docker daemon
+## These are flags passed after `docker -d`
+#DOCKER_OPTS=
diff --git a/system/docker/config/docker.logrotate b/system/docker/config/docker.logrotate
new file mode 100644
index 000000000000..41f96a65d481
--- /dev/null
+++ b/system/docker/config/docker.logrotate
@@ -0,0 +1,8 @@
+/var/log/docker.log {
+ rotate 5
+ notifempty
+ missingok
+ size=5M
+ compress
+ delaycompress
+}
diff --git a/system/docker/config/rc.docker b/system/docker/config/rc.docker
new file mode 100644
index 000000000000..bf6e183e4cc8
--- /dev/null
+++ b/system/docker/config/rc.docker
@@ -0,0 +1,80 @@
+#!/bin/sh
+
+# Short-Description: Create lightweight, portable, self-sufficient containers.
+# Description:
+# Docker is an open-source project to easily create lightweight, portable,
+# self-sufficient containers from any application. The same container that a
+# developer builds and tests on a laptop can run at scale, in production, on
+# VMs, bare metal, OpenStack clusters, public clouds and more.
+
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
+
+BASE=docker
+
+DOCKER=/usr/bin/$BASE
+DOCKER_PIDFILE=/var/run/$BASE.pid
+DOCKER_LOG=/var/log/docker.log
+DOCKER_OPTS=
+
+if [ -f /etc/default/$BASE ]; then
+ . /etc/default/$BASE
+fi
+
+# Check docker is present
+if [ ! -x $DOCKER ]; then
+ echo "$DOCKER not present or not executable"
+ exit 1
+fi
+
+docker_start() {
+ echo "starting $BASE ..."
+ if [ -x ${DOCKER} ]; then
+ # If there is an old PID file (no docker running), clean it up:
+ if [ -r ${DOCKER_PIDFILE} ]; then
+ if ! ps axc | grep docker 1> /dev/null 2> /dev/null ; then
+ echo "Cleaning up old ${DOCKER_PIDFILE}."
+ rm -f ${DOCKER_PIDFILE}
+ fi
+ fi
+ nohup ${DOCKER} -d -p ${DOCKER_PIDFILE} ${DOCKER_OPTS} >> ${DOCKER_LOG} 2>&1 &
+ fi
+}
+
+# Stop docker:
+docker_stop() {
+ echo "stopping $BASE ..."
+ # If there is no PID file, ignore this request...
+ if [ -r ${DOCKER_PIDFILE} ]; then
+ kill $(cat ${DOCKER_PIDFILE})
+ fi
+}
+
+# Restart docker:
+docker_restart() {
+ docker_stop
+ docker_start
+}
+
+case "$1" in
+'start')
+ docker_start
+ ;;
+'stop')
+ docker_stop
+ ;;
+'restart')
+ docker_restart
+ ;;
+'status')
+ if [ -f ${DOCKER_PIDFILE} ] && ps -o cmd $(cat ${DOCKER_PIDFILE}) | grep -q $BASE ; then
+ echo "status of $BASE: running"
+ else
+ echo "status of $BASE: stopped"
+ fi
+ ;;
+*)
+ echo "usage $0 start|stop|restart|status"
+esac
+
+exit 0