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