-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update init script #15
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,61 @@ | ||
# Generated by Ansible for {{ansible_fqdn}} | ||
description "Docker daemon" | ||
|
||
start on filesystem | ||
start on (filesystem and net-device-up IFACE!=lo) | ||
stop on runlevel [!2345] | ||
limit nofile 524288 1048576 | ||
limit nproc 524288 1048576 | ||
|
||
respawn | ||
|
||
kill timeout 20 | ||
|
||
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 | ||
[ ! -f /etc/default/docker ] || . /etc/default/docker | ||
/usr/bin/docker {{ docker_daemon_opts }} $DOCKER_OPTS | ||
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand why using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is originated from : https://github.com/docker/docker/blob/master/contrib/init/upstart/docker.conf |
||
DOCKER=/usr/bin/$UPSTART_JOB | ||
DOCKER_OPTS= | ||
if [ -f /etc/default/$UPSTART_JOB ]; then | ||
. /etc/default/$UPSTART_JOB | ||
fi | ||
exec "$DOCKER" daemon $DOCKER_OPTS | ||
end script | ||
|
||
# Don't emit "started" event until docker.sock is ready. | ||
# See https://github.com/docker/docker/issues/6647 | ||
post-start script | ||
DOCKER_OPTS= | ||
if [ -f /etc/default/$UPSTART_JOB ]; then | ||
. /etc/default/$UPSTART_JOB | ||
fi | ||
if ! printf "%s" "$DOCKER_OPTS" | grep -qE -e '-H|--host'; then | ||
while ! [ -e /var/run/docker.sock ]; do | ||
initctl status $UPSTART_JOB | grep -qE "(stop|respawn)/" && exit 1 | ||
echo "Waiting for /var/run/docker.sock" | ||
sleep 0.1 | ||
done | ||
echo "/var/run/docker.sock is up" | ||
fi | ||
end script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems too arbitrary. Would be nice to control what limits to use or at least these limit values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This configuration sometimes seems to be needed as far as I see in moby/moby#5939 and moby/moby#4455 (systemd), corresponding fix for upstart is moby/moby#4749 , moby/moby@119839d