Skip to content

Commit e7e1b3c

Browse files
committed
entrypoint: Launch our entrypoint via tini
Even single process containers (which this one is actually not) should have an init system. However most init systems are too big and complex for containerization purposes. [Dumb-init][0] (and tini init) address this problem _specifically_ for Docker containers. See the [dumb-init][0] documentation for more details. [0]: https://github.com/Yelp/dumb-init Signed-off-by: Olliver Schinagl <[email protected]>
1 parent 10fa7fc commit e7e1b3c

4 files changed

+10
-2
lines changed

Dockerfile-alpine-slim.template

+3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ RUN set -x \
9999
# forward request and error logs to docker log collector
100100
&& ln -sf /dev/stdout /var/log/nginx/access.log \
101101
&& ln -sf /dev/stderr /var/log/nginx/error.log \
102+
# Ensure we can run our entrypoint and make it debian compatible
103+
&& apk add --no-cache tini \
104+
&& ln -s /sbin/tini /usr/bin/tini \
102105
# create a docker-entrypoint.d directory
103106
&& mkdir /docker-entrypoint.d
104107

Dockerfile-alpine.template

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,7 @@ RUN set -x \
7575
&& if [ -n "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \
7676
&& if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \
7777
# Bring in curl and ca-certificates to make registering on DNS SD easier
78-
&& apk add --no-cache curl ca-certificates
78+
&& apk add --no-cache curl ca-certificates \
79+
# Ensure we can run our entrypoint and do it compatible with alpine
80+
&& apk add --no-cache tini \
81+
&& ln -s /sbin/tini /usr/bin/tini

Dockerfile-debian.template

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ RUN set -x \
8282
$nginxPackages \
8383
gettext-base \
8484
curl \
85+
tini \
86+
&& ln -s /usr/bin/tini /sbin/tini \
8587
&& apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list \
8688
\
8789
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)

entrypoint/docker-entrypoint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/sbin/init /bin/sh
22
# vim:sw=4:ts=4:et
33

44
set -e

0 commit comments

Comments
 (0)