diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index f6257a6935..33b8734948 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM fluent/fluentd:v1.4.2-onbuild-1.0 +FROM fluent/fluentd:v1.6.2-1.0 # Use root account to use apk USER root @@ -64,6 +64,7 @@ ENV VERIFY_SSL "true" RUN mkdir -p /fluentd/conf.d -COPY ./fluent.conf /fluentd/conf.d/fluent.conf +COPY ./fluent.conf /fluentd/etc/ +COPY entrypoint.sh /bin/ USER fluent diff --git a/deploy/docker/entrypoint.sh b/deploy/docker/entrypoint.sh new file mode 100755 index 0000000000..876b4244fb --- /dev/null +++ b/deploy/docker/entrypoint.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +#source vars if file exists +DEFAULT=/etc/default/fluentd + +if [ -r $DEFAULT ]; then + set -o allexport + . $DEFAULT + set +o allexport +fi + +# If the user has supplied only arguments append them to `fluentd` command +if [ "${1#-}" != "$1" ]; then + set -- fluentd "$@" +fi + +# If user does not supply config file or plugins, use the default +if [ "$1" = "fluentd" ]; then + if ! echo $@ | grep ' \-c' ; then + set -- "$@" -c /fluentd/etc/${FLUENTD_CONF} + fi + + if ! echo $@ | grep ' \-p' ; then + set -- "$@" -p /fluentd/plugins + fi +fi + +exec "$@"