Skip to content

Commit 2c51119

Browse files
committed
entrypoint: Launch our entrypoint via dumb-init
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 <oliver@schinagl.nl>
1 parent 10fa7fc commit 2c51119

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

Dockerfile-alpine-slim.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ 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
103+
&& apk add --no-cache dumb-init \
102104
# create a docker-entrypoint.d directory
103105
&& mkdir /docker-entrypoint.d
104106

Dockerfile-alpine.template

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,6 @@ 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
80+
&& apk add --no-cache dumb-init

Dockerfile-debian.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ RUN set -x \
8282
$nginxPackages \
8383
gettext-base \
8484
curl \
85+
dumb-init \
8586
&& apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list \
8687
\
8788
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)

entrypoint/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/dumb-init /bin/sh
22
# vim:sw=4:ts=4:et
33

44
set -e

0 commit comments

Comments
 (0)