summaryrefslogtreecommitdiff
path: root/contrib/init/upstart/docker.conf
blob: e2cc4536e126c1342e70e04a69abb194b70bb0bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
description "Docker daemon"

start on filesystem
stop on runlevel [!2345]

respawn

script
	# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
	DOCKER=/usr/bin/$UPSTART_JOB
	DOCKER_OPTS=
	if [ -f /etc/default/$UPSTART_JOB ]; then
		. /etc/default/$UPSTART_JOB
	fi
	if ! grep -q cgroup /proc/mounts; then
		# rough approximation of cgroupfs-mount
		mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
		for sys in $(cut -d'	' -f1 /proc/cgroups); do
			mkdir -p /sys/fs/cgroup/$sys
			if ! mount -n -t cgroup -o $sys cgroup /sys/fs/cgroup/$sys 2>/dev/null; then
				rmdir /sys/fs/cgroup/$sys 2>/dev/null || true
			fi
		done
	fi
	"$DOCKER" -d $DOCKER_OPTS
end script