From d18c045c982ca10d0cca2854fa55c63ca7385b15 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Fri, 16 Jul 2021 06:14:02 -0700 Subject: [PATCH] Docker: use tini as init system (#72) --- Dockerfile | 4 +++- README.md | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0c8e522..c726a98 100644 --- a/Dockerfile +++ b/Dockerfile @@ -119,12 +119,14 @@ RUN description="$(file /tmp/binary)" && \ FROM alpine:${ALPINE_VERSION} EXPOSE 9586/tcp WORKDIR /usr/local/bin +RUN apk add --no-cache --q tini && \ + rm -rf /var/cache/apk/* RUN adduser prometheus-wireguard-exporter -s /bin/sh -D -u 1000 1000 && \ mkdir -p /etc/sudoers.d && \ echo 'prometheus-wireguard-exporter ALL=(root) NOPASSWD:/usr/bin/wg show * dump' > /etc/sudoers.d/prometheus-wireguard-exporter && \ chmod 0440 /etc/sudoers.d/prometheus-wireguard-exporter RUN apk add --update -q --no-cache wireguard-tools-wg sudo USER prometheus-wireguard-exporter -ENTRYPOINT [ "/usr/local/bin/prometheus_wireguard_exporter" ] +ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/prometheus_wireguard_exporter"] CMD [ "-a" ] COPY --from=build --chown=prometheus-wireguard-exporter /tmp/binary ./prometheus_wireguard_exporter diff --git a/README.md b/README.md index 7439d8e..7dcdc4b 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Coming soon, subcribe to [#59](https://github.com/MindFlavor/prometheus_wireguar 1. Download and run the container with: ```sh - docker run -d --init --net=host --cap-add=NET_ADMIN --name wgexporter mindflavor/prometheus-wireguard-exporter + docker run -d --net=host --cap-add=NET_ADMIN --name wgexporter mindflavor/prometheus-wireguard-exporter ``` 1. Check it's up by visiting [http://localhost:9586/metrics](http://localhost:9586/metrics)