summaryrefslogtreecommitdiffstats
path: root/docker/alpine
diff options
context:
space:
mode:
authorWesley Coakley <w@wesleycoakley.com>2021-06-09 05:50:43 +0200
committerWesley Coakley <w@wesleycoakley.com>2021-06-16 04:23:50 +0200
commit7266ad4588581bd3d6970dc78ff92bb312a0c63b (patch)
tree19c3ab40ae97ea98eeea9c6996e8bd2591c7d947 /docker/alpine
parentMerge pull request #8831 from sworleys/Fix-No-Ospf-Func (diff)
downloadfrr-7266ad4588581bd3d6970dc78ff92bb312a0c63b.tar.xz
frr-7266ad4588581bd3d6970dc78ff92bb312a0c63b.zip
docker: Use tini unilaterally and stop tailing /dev/null
tini is a hyper-minimal PID 0 which spawns a child process (watchfrr.sh in our case), reaps zombies and forwards signals to the script. Starting watchfrr.sh directly instead of through the old `tail /dev/null` or `sleep 365d` helps keep things clean too :) While tini was previously only used in the Alpine container it is useful to apply this PID 0 to all containers except the special CI ones. Fixes: #8788 Signed-off-by: Wesley Coakley <w@wesleycoakley.com>
Diffstat (limited to 'docker/alpine')
-rw-r--r--docker/alpine/Dockerfile11
-rwxr-xr-xdocker/alpine/docker-start14
2 files changed, 13 insertions, 12 deletions
diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile
index cb2b3eb69..8fc36c0e5 100644
--- a/docker/alpine/Dockerfile
+++ b/docker/alpine/Dockerfile
@@ -55,5 +55,14 @@ RUN apk add \
--no-cache \
--allow-untrusted /pkgs/apk/*/*.apk \
&& rm -rf /pkgs
+
+# Own the config / PID files
+RUN mkdir -p /var/run/frr
+RUN chown -R frr:frr /etc/frr /var/run/frr
+
+# Simple init manager for reaping processes and forwarding signals
+ENTRYPOINT ["/sbin/tini", "--"]
+
+# Default CMD starts watchfrr
COPY docker/alpine/docker-start /usr/lib/frr/docker-start
-CMD [ "/sbin/tini", "--", "/usr/lib/frr/docker-start" ]
+CMD ["/usr/lib/frr/docker-start"]
diff --git a/docker/alpine/docker-start b/docker/alpine/docker-start
index 3f7737d3b..c20df42e8 100755
--- a/docker/alpine/docker-start
+++ b/docker/alpine/docker-start
@@ -1,12 +1,4 @@
-#!/bin/sh
+#!/bin/ash
-set -e
-
-##
-# For volume mounts...
-##
-chown -R frr:frr /etc/frr || true
-/usr/lib/frr/frrinit.sh start
-
-# Sleep forever
-exec tail -f /dev/null
+source /usr/lib/frr/frrcommon.sh
+/usr/lib/frr/watchfrr $(daemon_list)