From 275677e94ff2912a78cc733400436c53629806ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Tue, 2 Apr 2019 14:59:29 +0200 Subject: [PATCH] openrc: Modernize and sync settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use rc_ulimit for ulimit constraints * Synchronize ulimit settings to systemd's * Add support for reload command * Add support for retry settings for docker stop/restart Signed-off-by: Manuel RĂ¼ger --- contrib/init/openrc/docker.confd | 6 ++++++ contrib/init/openrc/docker.initd | 20 ++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/contrib/init/openrc/docker.confd b/contrib/init/openrc/docker.confd index 89183de46b..cc599e6da4 100644 --- a/contrib/init/openrc/docker.confd +++ b/contrib/init/openrc/docker.confd @@ -16,6 +16,12 @@ # where docker's pid get stored #DOCKER_PIDFILE="/run/docker.pid" +# Settings for process limits (ulimit) +#DOCKER_ULIMIT="-c unlimited -n 1048576 -u unlimited" + +# seconds to wait for sending SIGTERM and SIGKILL signals when stopping docker +#DOCKER_RETRY="TERM/60/KILL/10" + # where the docker daemon itself is run from #DOCKERD_BINARY="/usr/bin/dockerd" diff --git a/contrib/init/openrc/docker.initd b/contrib/init/openrc/docker.initd index 6c968f607e..05d910ffd8 100644 --- a/contrib/init/openrc/docker.initd +++ b/contrib/init/openrc/docker.initd @@ -11,14 +11,18 @@ DOCKER_OUTFILE="${DOCKER_OUTFILE:-${DOCKER_LOGFILE}}" start_stop_daemon_args="--background \ --stderr \"${DOCKER_ERRFILE}\" --stdout \"${DOCKER_OUTFILE}\"" +extra_started_commands="reload" + +rc_ulimit="${DOCKER_ULIMIT:--c unlimited -n 1048576 -u unlimited}" + +retry="${DOCKER_RETRY:-TERM/60/KILL/10}" + start_pre() { checkpath -f -m 0644 -o root:docker "$DOCKER_LOGFILE" - - ulimit -n 1048576 - - # Having non-zero limits causes performance problems due to accounting overhead - # in the kernel. We recommend using cgroups to do container-local accounting. - ulimit -u unlimited - - return 0 +} + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + start-stop-daemon --signal HUP --pidfile "${pidfile}" + eend $? "Failed to stop ${RC_SVCNAME}" }