projects/aports·blob master · refs

51 lines · 1.4 KiB

1#!/sbin/openrc-run
2supervisor=supervise-daemon
3
4name="Docker Daemon"
5description="Persistent process that manages docker containers"
6description_reload="Reload configuration without exiting"
7
8command="${DOCKERD_BINARY:-/usr/bin/dockerd}"
9command_args="${DOCKER_OPTS}"
10
11DOCKER_LOGFILE="${DOCKER_LOGFILE:-/var/log/${RC_SVCNAME}.log}"
12DOCKER_ERRFILE="${DOCKER_ERRFILE:-${DOCKER_LOGFILE}}"
13DOCKER_OUTFILE="${DOCKER_OUTFILE:-${DOCKER_LOGFILE}}"
14if [ "$DOCKER_ERRFILE" = "$DOCKER_OUTFILE" ]; then
15 LOGPROXY_OPTS="$LOGPROXY_OPTS -m"
16fi
17export \
18 LOGPROXY_CHMOD="${LOGPROXY_CHMOD:-0644}" \
19 LOGPROXY_LOG_DIRECTORY="${LOGPROXY_LOG_DIRECTORY:-/var/log}" \
20 LOGPROXY_ROTATION_SIZE="${LOGPROXY_ROTATION_SIZE:-104857600}" \
21 LOGPROXY_ROTATION_TIME="${LOGPROXY_ROTATION_TIME:-86400}" \
22 LOGPROXY_ROTATION_SUFFIX="${LOGPROXY_ROTATION_SUFFIX:-.%Y%m%d%H%M%S}" \
23 LOGPROXY_ROTATED_FILES="${LOGPROXY_ROTATED_FILES:-5}"
24
25output_logger="log_proxy $LOGPROXY_OPTS $DOCKER_OUTFILE"
26error_logger="log_proxy $LOGPROXY_OPTS $DOCKER_ERRFILE"
27
28extra_started_commands="reload"
29
30rc_ulimit="${DOCKER_ULIMIT:--c unlimited -n 1048576 -u unlimited}"
31
32retry="${DOCKER_RETRY:-TERM/60/KILL/10}"
33
34if [ -e /etc/profile.d/proxy.sh ]; then
35 . /etc/profile.d/proxy.sh
36fi
37
38depend() {
39 need sysfs cgroups net
40 after firewall
41}
42
43start_pre() {
44 checkpath -f -m 0644 -o root:docker "$DOCKER_ERRFILE" "$DOCKER_OUTFILE"
45}
46
47reload() {
48 ebegin "Reloading configuration"
49 $supervisor $RC_SVCNAME --signal HUP
50 eend $?
51}