diff options
Diffstat (limited to 'system/docker/config')
-rw-r--r-- | system/docker/config/docker.default | 6 | ||||
-rw-r--r-- | system/docker/config/docker.logrotate | 13 | ||||
-rw-r--r-- | system/docker/config/rc.docker | 107 |
3 files changed, 66 insertions, 60 deletions
diff --git a/system/docker/config/docker.default b/system/docker/config/docker.default index ae2989490d..f24ae34624 100644 --- a/system/docker/config/docker.default +++ b/system/docker/config/docker.default @@ -1,3 +1,3 @@ -## Set defaults used by the docker daemon -## These are flags passed after `docker -d` -#DOCKER_OPTS= +## Set defaults used by the docker daemon. +## These are flags passed after `dockerd`. +#DOCKER_OPTS="" diff --git a/system/docker/config/docker.logrotate b/system/docker/config/docker.logrotate index 41f96a65d4..016980dde2 100644 --- a/system/docker/config/docker.logrotate +++ b/system/docker/config/docker.logrotate @@ -1,8 +1,9 @@ /var/log/docker.log { - rotate 5 - notifempty - missingok - size=5M - compress - delaycompress + daily + rotate 7 + copytruncate + delaycompress + compress + notifempty + missingok } diff --git a/system/docker/config/rc.docker b/system/docker/config/rc.docker index 0199623116..90548ca4b0 100644 --- a/system/docker/config/rc.docker +++ b/system/docker/config/rc.docker @@ -1,81 +1,86 @@ #!/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. - +# +# Docker startup script for Slackware Linux +# +# Docker is an open-source project to easily create lightweight, portable, +# self-sufficient containers from any application. PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin -BASE=docker +BASE=dockerd UNSHARE=/usr/bin/unshare -DOCKER=/usr/bin/$BASE -DOCKER_PIDFILE=/var/run/$BASE.pid +DOCKER=/usr/bin/${BASE} +DOCKER_PIDFILE=/var/run/${BASE}.pid DOCKER_LOG=/var/log/docker.log -DOCKER_OPTS= +DOCKER_OPTS="" -if [ -f /etc/default/$BASE ]; then - . /etc/default/$BASE +# Default options. +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 +# Check if 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 + echo "Starting ${BASE} ..." + # If there is an old PID file (no dockerd running), clean it up. + if [ -r ${DOCKER_PIDFILE} ]; then + if ! ps axc | grep ${BASE} 1> /dev/null 2> /dev/null ; then + echo "Cleaning up old ${DOCKER_PIDFILE}." + rm -f ${DOCKER_PIDFILE} fi - nohup "${UNSHARE}" -m -- ${DOCKER} -d -p ${DOCKER_PIDFILE} ${DOCKER_OPTS} >> ${DOCKER_LOG} 2>&1 & fi + + nohup "${UNSHARE}" -m -- ${DOCKER} -p ${DOCKER_PIDFILE} ${DOCKER_OPTS} >> ${DOCKER_LOG} 2>&1 & } -# Stop docker: docker_stop() { - echo "stopping $BASE ..." - # If there is no PID file, ignore this request... + echo -n "Stopping ${BASE} ..." if [ -r ${DOCKER_PIDFILE} ]; then - kill $(cat ${DOCKER_PIDFILE}) + DOCKER_PID=$(cat ${DOCKER_PIDFILE}) + kill ${DOCKER_PID} + while [ -d /proc/${DOCKER_PID} ]; do + sleep 1 + echo -n "." + done fi + echo " done" } -# Restart docker: docker_restart() { - docker_stop - docker_start + docker_stop + sleep 1 + 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" +docker_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" + echo "Status of ${BASE}: stopped" fi - ;; -*) - echo "usage $0 start|stop|restart|status" +} + +case "$1" in + 'start') + docker_start + ;; + 'stop') + docker_stop + ;; + 'restart') + docker_restart + ;; + 'status') + docker_status + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" esac exit 0 |