Skip to content

Instantly share code, notes, and snippets.

@shovon
Created June 17, 2014 16:28
Show Gist options
  • Save shovon/4758e3af94586f1d6285 to your computer and use it in GitHub Desktop.
Save shovon/4758e3af94586f1d6285 to your computer and use it in GitHub Desktop.
This is a modification of the original Upstart script. It is intended for those that get the latest binary downloads.
description "Docker daemon"
start on filesystem
stop on runlevel [!2345]
respawn
pre-start script
# see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
if grep -v '^#' /etc/fstab | grep -q cgroup \
|| [ ! -e /proc/cgroups ] \
|| [ ! -d /sys/fs/cgroup ]; then
exit 0
fi
if ! mountpoint -q /sys/fs/cgroup; then
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi
(
cd /sys/fs/cgroup
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mkdir -p $sys
if ! mountpoint -q $sys; then
if ! mount -n -t cgroup -o $sys cgroup $sys; then
rmdir $sys || true
fi
fi
done
)
end script
script
docker -d
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment