Skip to content

Instantly share code, notes, and snippets.

@onjin
Created July 12, 2013 08:19
Show Gist options
  • Save onjin/5982766 to your computer and use it in GitHub Desktop.
Save onjin/5982766 to your computer and use it in GitHub Desktop.
/etc/init.d/docker file for debian
#!/bin/sh
# https://launchpad.net/~dotcloud/+archive/lxc-docker/+packages
### BEGIN INIT INFO
# Provides: docker
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: autofs $network $named alsa-utils pulseaudio
# Should-Stop: autofs $network $named alsa-utils pulseaudio
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Music Player Daemon
# Description: Start the docker daemon
### END INIT INFO
. /lib/lsb/init-functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=docker
DESC="docker daemon"
DAEMON=/usr/bin/docker
PIDFILE=/var/run/docker.pid
DOCKER_OPTS="-d=true"
docker_start () {
log_action_msg "Starting $DESC" "$NAME"
start-stop-daemon --start --quiet --oknodo --pidfile "$PIDFILE" \
--exec "$DAEMON" -- $DOCKER_OPTS &
log_end_msg $?
}
docker_stop () {
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --quiet --oknodo --retry 5 --pidfile "$PIDFILE" \
--exec $DAEMON
log_end_msg $?
}
case "$1" in
start)
docker_start
;;
stop)
docker_stop
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME
;;
restart|force-reload)
docker_stop
docker_start
;;
force-start)
docker_start
;;
force-restart)
docker_stop
docker_start
;;
force-reload)
docker_stop
docker_start
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 2
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment