diff options
author | Wesley Coakley <w@wesleycoakley.com> | 2021-06-09 05:50:43 +0200 |
---|---|---|
committer | Wesley Coakley <w@wesleycoakley.com> | 2021-06-16 04:23:50 +0200 |
commit | 7266ad4588581bd3d6970dc78ff92bb312a0c63b (patch) | |
tree | 19c3ab40ae97ea98eeea9c6996e8bd2591c7d947 /docker/debian | |
parent | Merge pull request #8831 from sworleys/Fix-No-Ospf-Func (diff) | |
download | frr-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/debian')
-rw-r--r-- | docker/debian/Dockerfile | 16 | ||||
-rwxr-xr-x | docker/debian/docker-start | 14 |
2 files changed, 15 insertions, 15 deletions
diff --git a/docker/debian/Dockerfile b/docker/debian/Dockerfile index cc9217f10..7476e5fe3 100644 --- a/docker/debian/Dockerfile +++ b/docker/debian/Dockerfile @@ -6,8 +6,8 @@ ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn RUN apt-get update && \ apt-get install -y libpcre3-dev apt-transport-https ca-certificates curl wget logrotate \ - libc-ares2 libjson-c3 vim procps libreadline7 gnupg2 lsb-release apt-utils && \ - rm -rf /var/lib/apt/lists/* + libc-ares2 libjson-c3 vim procps libreadline7 gnupg2 lsb-release apt-utils \ + tini && rm -rf /var/lib/apt/lists/* RUN curl -s https://deb.frrouting.org/frr/keys.asc | apt-key add - RUN echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) frr-stable | tee -a /etc/apt/sources.list.d/frr.list @@ -16,5 +16,13 @@ RUN apt-get update && \ apt-get install -y frr frr-pythontools && \ rm -rf /var/lib/apt/lists/* -ADD docker-start /usr/sbin/docker-start -CMD ["/usr/sbin/docker-start"] +# 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 ["/usr/bin/tini", "--"] + +# Default CMD starts watchfrr +COPY docker-start /usr/lib/frr/docker-start +CMD ["/usr/lib/frr/docker-start"] diff --git a/docker/debian/docker-start b/docker/debian/docker-start index a0f31f5ac..d954142ab 100755 --- a/docker/debian/docker-start +++ b/docker/debian/docker-start @@ -1,12 +1,4 @@ -#!/bin/sh +#!/bin/bash -set -e - -## -# For volume mounts... -## -chown -R frr:frr /etc/frr -/etc/init.d/frr start - -# Sleep forever -exec tail -f /dev/null +source /usr/lib/frr/frrcommon.sh +/usr/lib/frr/watchfrr $(daemon_list) |