From 453e0f506c5ecc3a6df58d1704a0f9ca87078125 Mon Sep 17 00:00:00 2001 From: Angus Williams Date: Thu, 9 Apr 2020 19:55:32 +1200 Subject: [PATCH] Adds influxdb user to alpine Dockerfiles Allow containers to be run as non root by adding an influxdb user and group. Home directory of the user is set to the data dir of influx --- influxdb/1.5/alpine/Dockerfile | 4 +++- influxdb/1.6/alpine/Dockerfile | 4 +++- influxdb/1.7/alpine/Dockerfile | 4 +++- influxdb/nightly/alpine/Dockerfile | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/influxdb/1.5/alpine/Dockerfile b/influxdb/1.5/alpine/Dockerfile index ecb135c5b..af856feca 100644 --- a/influxdb/1.5/alpine/Dockerfile +++ b/influxdb/1.5/alpine/Dockerfile @@ -23,7 +23,9 @@ RUN set -ex && \ chmod +x /usr/src/influxdb-*/* && \ cp -a /usr/src/influxdb-*/* /usr/bin/ && \ rm -rf *.tar.gz* /usr/src /root/.gnupg && \ - apk del .build-deps + apk del .build-deps && \ + addgroup -g 1000 influxdb && \ + adduser -G influxdb -u 1000 -S -h /var/lib/influxdb influxdb COPY influxdb.conf /etc/influxdb/influxdb.conf EXPOSE 8086 diff --git a/influxdb/1.6/alpine/Dockerfile b/influxdb/1.6/alpine/Dockerfile index 879e767f7..168cef704 100644 --- a/influxdb/1.6/alpine/Dockerfile +++ b/influxdb/1.6/alpine/Dockerfile @@ -23,7 +23,9 @@ RUN set -ex && \ chmod +x /usr/src/influxdb-*/* && \ cp -a /usr/src/influxdb-*/* /usr/bin/ && \ rm -rf *.tar.gz* /usr/src /root/.gnupg && \ - apk del .build-deps + apk del .build-deps && \ + addgroup -g 1000 influxdb && \ + adduser -G influxdb -u 1000 -S -h /var/lib/influxdb influxdb COPY influxdb.conf /etc/influxdb/influxdb.conf EXPOSE 8086 diff --git a/influxdb/1.7/alpine/Dockerfile b/influxdb/1.7/alpine/Dockerfile index 9de292350..c9dedddce 100644 --- a/influxdb/1.7/alpine/Dockerfile +++ b/influxdb/1.7/alpine/Dockerfile @@ -23,7 +23,9 @@ RUN set -ex && \ chmod +x /usr/src/influxdb-*/* && \ cp -a /usr/src/influxdb-*/* /usr/bin/ && \ rm -rf *.tar.gz* /usr/src /root/.gnupg && \ - apk del .build-deps + apk del .build-deps && \ + addgroup -g 1000 influxdb && \ + adduser -G influxdb -u 1000 -S -h /var/lib/influxdb influxdb COPY influxdb.conf /etc/influxdb/influxdb.conf EXPOSE 8086 diff --git a/influxdb/nightly/alpine/Dockerfile b/influxdb/nightly/alpine/Dockerfile index 2957ed898..053cb85fa 100644 --- a/influxdb/nightly/alpine/Dockerfile +++ b/influxdb/nightly/alpine/Dockerfile @@ -21,7 +21,9 @@ RUN set -ex && \ chmod +x /usr/src/influxdb-*/* && \ cp -a /usr/src/influxdb-*/* /usr/bin/ && \ rm -rf *.tar.gz* /usr/src /root/.gnupg && \ - apk del .build-deps + apk del .build-deps && \ + addgroup -g 1000 influxdb && \ + adduser -G influxdb -u 1000 -S -h /var/lib/influxdb influxdb COPY influxdb.conf /etc/influxdb/influxdb.conf EXPOSE 8083 8086