From ea1d29461312741ebbe620cce44f2e1eb4a7db88 Mon Sep 17 00:00:00 2001 From: David Yeung Date: Wed, 2 Aug 2017 00:57:13 +1000 Subject: [PATCH 1/2] Start fluent with exec in entrypoint.sh Removing entrypoint.sh from the process tree helps us to manage signals better. --- entrypoint.sh.erb | 4 ++-- v0.12/alpine-onbuild/entrypoint.sh | 2 +- v0.12/alpine/entrypoint.sh | 2 +- v0.12/debian-onbuild/entrypoint.sh | 2 +- v0.12/debian/entrypoint.sh | 2 +- v0.14/alpine-onbuild/entrypoint.sh | 2 +- v0.14/alpine/entrypoint.sh | 2 +- v0.14/debian-onbuild/entrypoint.sh | 2 +- v0.14/debian/entrypoint.sh | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/entrypoint.sh.erb b/entrypoint.sh.erb index c9cf8e01..7bd64cbc 100644 --- a/entrypoint.sh.erb +++ b/entrypoint.sh.erb @@ -22,7 +22,7 @@ chown -R fluent /home/fluent chown -R fluent /fluentd <% if is_alpine %> -su-exec fluent "$@" +exec su-exec fluent "$@" <% else %> -gosu fluent "$@" +exec gosu fluent "$@" <% end %> diff --git a/v0.12/alpine-onbuild/entrypoint.sh b/v0.12/alpine-onbuild/entrypoint.sh index a5850640..6515d970 100644 --- a/v0.12/alpine-onbuild/entrypoint.sh +++ b/v0.12/alpine-onbuild/entrypoint.sh @@ -15,4 +15,4 @@ adduser -D -g '' -u ${uid} -h /home/fluent fluent chown -R fluent /home/fluent chown -R fluent /fluentd -su-exec fluent "$@" +exec su-exec fluent "$@" diff --git a/v0.12/alpine/entrypoint.sh b/v0.12/alpine/entrypoint.sh index a5850640..6515d970 100644 --- a/v0.12/alpine/entrypoint.sh +++ b/v0.12/alpine/entrypoint.sh @@ -15,4 +15,4 @@ adduser -D -g '' -u ${uid} -h /home/fluent fluent chown -R fluent /home/fluent chown -R fluent /fluentd -su-exec fluent "$@" +exec su-exec fluent "$@" diff --git a/v0.12/debian-onbuild/entrypoint.sh b/v0.12/debian-onbuild/entrypoint.sh index f3f92aa5..a21b79d5 100644 --- a/v0.12/debian-onbuild/entrypoint.sh +++ b/v0.12/debian-onbuild/entrypoint.sh @@ -16,4 +16,4 @@ export HOME=/home/fluent chown -R fluent /home/fluent chown -R fluent /fluentd -gosu fluent "$@" +exec gosu fluent "$@" diff --git a/v0.12/debian/entrypoint.sh b/v0.12/debian/entrypoint.sh index f3f92aa5..a21b79d5 100644 --- a/v0.12/debian/entrypoint.sh +++ b/v0.12/debian/entrypoint.sh @@ -16,4 +16,4 @@ export HOME=/home/fluent chown -R fluent /home/fluent chown -R fluent /fluentd -gosu fluent "$@" +exec gosu fluent "$@" diff --git a/v0.14/alpine-onbuild/entrypoint.sh b/v0.14/alpine-onbuild/entrypoint.sh index a5850640..6515d970 100644 --- a/v0.14/alpine-onbuild/entrypoint.sh +++ b/v0.14/alpine-onbuild/entrypoint.sh @@ -15,4 +15,4 @@ adduser -D -g '' -u ${uid} -h /home/fluent fluent chown -R fluent /home/fluent chown -R fluent /fluentd -su-exec fluent "$@" +exec su-exec fluent "$@" diff --git a/v0.14/alpine/entrypoint.sh b/v0.14/alpine/entrypoint.sh index a5850640..6515d970 100644 --- a/v0.14/alpine/entrypoint.sh +++ b/v0.14/alpine/entrypoint.sh @@ -15,4 +15,4 @@ adduser -D -g '' -u ${uid} -h /home/fluent fluent chown -R fluent /home/fluent chown -R fluent /fluentd -su-exec fluent "$@" +exec su-exec fluent "$@" diff --git a/v0.14/debian-onbuild/entrypoint.sh b/v0.14/debian-onbuild/entrypoint.sh index f3f92aa5..a21b79d5 100644 --- a/v0.14/debian-onbuild/entrypoint.sh +++ b/v0.14/debian-onbuild/entrypoint.sh @@ -16,4 +16,4 @@ export HOME=/home/fluent chown -R fluent /home/fluent chown -R fluent /fluentd -gosu fluent "$@" +exec gosu fluent "$@" diff --git a/v0.14/debian/entrypoint.sh b/v0.14/debian/entrypoint.sh index f3f92aa5..a21b79d5 100644 --- a/v0.14/debian/entrypoint.sh +++ b/v0.14/debian/entrypoint.sh @@ -16,4 +16,4 @@ export HOME=/home/fluent chown -R fluent /home/fluent chown -R fluent /fluentd -gosu fluent "$@" +exec gosu fluent "$@" From 328d5f654dc84fde0e5a3e6922e373dfd6f0492d Mon Sep 17 00:00:00 2001 From: David Yeung Date: Wed, 2 Aug 2017 01:05:54 +1000 Subject: [PATCH 2/2] Start fluent with exec in command Removing the command's one line script from the process tree helps us to manage signals better. --- Dockerfile.template.erb | 2 +- v0.12/alpine-onbuild/Dockerfile | 2 +- v0.12/alpine/Dockerfile | 2 +- v0.12/debian-onbuild/Dockerfile | 2 +- v0.12/debian/Dockerfile | 2 +- v0.14/alpine-onbuild/Dockerfile | 2 +- v0.14/alpine/Dockerfile | 2 +- v0.14/debian-onbuild/Dockerfile | 2 +- v0.14/debian/Dockerfile | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile.template.erb b/Dockerfile.template.erb index abf4b0c3..108cfe26 100644 --- a/Dockerfile.template.erb +++ b/Dockerfile.template.erb @@ -106,4 +106,4 @@ EXPOSE 24224 5140 ENTRYPOINT ["/bin/entrypoint.sh"] -CMD fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT +CMD exec fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT diff --git a/v0.12/alpine-onbuild/Dockerfile b/v0.12/alpine-onbuild/Dockerfile index 46237467..b88e5203 100644 --- a/v0.12/alpine-onbuild/Dockerfile +++ b/v0.12/alpine-onbuild/Dockerfile @@ -52,4 +52,4 @@ EXPOSE 24224 5140 ENTRYPOINT ["/bin/entrypoint.sh"] -CMD fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT +CMD exec fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT diff --git a/v0.12/alpine/Dockerfile b/v0.12/alpine/Dockerfile index 8317f4e8..aecaf808 100644 --- a/v0.12/alpine/Dockerfile +++ b/v0.12/alpine/Dockerfile @@ -50,4 +50,4 @@ EXPOSE 24224 5140 ENTRYPOINT ["/bin/entrypoint.sh"] -CMD fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT +CMD exec fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT diff --git a/v0.12/debian-onbuild/Dockerfile b/v0.12/debian-onbuild/Dockerfile index edbe3db0..aba405b2 100644 --- a/v0.12/debian-onbuild/Dockerfile +++ b/v0.12/debian-onbuild/Dockerfile @@ -70,4 +70,4 @@ EXPOSE 24224 5140 ENTRYPOINT ["/bin/entrypoint.sh"] -CMD fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT +CMD exec fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT diff --git a/v0.12/debian/Dockerfile b/v0.12/debian/Dockerfile index c702e4b7..9bf8919f 100644 --- a/v0.12/debian/Dockerfile +++ b/v0.12/debian/Dockerfile @@ -68,4 +68,4 @@ EXPOSE 24224 5140 ENTRYPOINT ["/bin/entrypoint.sh"] -CMD fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT +CMD exec fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT diff --git a/v0.14/alpine-onbuild/Dockerfile b/v0.14/alpine-onbuild/Dockerfile index cf14e05a..9236ab17 100644 --- a/v0.14/alpine-onbuild/Dockerfile +++ b/v0.14/alpine-onbuild/Dockerfile @@ -52,4 +52,4 @@ EXPOSE 24224 5140 ENTRYPOINT ["/bin/entrypoint.sh"] -CMD fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT +CMD exec fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT diff --git a/v0.14/alpine/Dockerfile b/v0.14/alpine/Dockerfile index 3b790909..ad9fb9bd 100644 --- a/v0.14/alpine/Dockerfile +++ b/v0.14/alpine/Dockerfile @@ -50,4 +50,4 @@ EXPOSE 24224 5140 ENTRYPOINT ["/bin/entrypoint.sh"] -CMD fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT +CMD exec fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT diff --git a/v0.14/debian-onbuild/Dockerfile b/v0.14/debian-onbuild/Dockerfile index ae1e02c1..f95c670e 100644 --- a/v0.14/debian-onbuild/Dockerfile +++ b/v0.14/debian-onbuild/Dockerfile @@ -70,4 +70,4 @@ EXPOSE 24224 5140 ENTRYPOINT ["/bin/entrypoint.sh"] -CMD fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT +CMD exec fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT diff --git a/v0.14/debian/Dockerfile b/v0.14/debian/Dockerfile index e7293fe7..be0642be 100644 --- a/v0.14/debian/Dockerfile +++ b/v0.14/debian/Dockerfile @@ -68,4 +68,4 @@ EXPOSE 24224 5140 ENTRYPOINT ["/bin/entrypoint.sh"] -CMD fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT +CMD exec fluentd -c /fluentd/etc/${FLUENTD_CONF} -p /fluentd/plugins $FLUENTD_OPT