Skip to content

Commit 0c101ba

Browse files
committed
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
1 parent 29ba808 commit 0c101ba

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

influxdb/1.5/alpine/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ RUN set -ex && \
2323
chmod +x /usr/src/influxdb-*/* && \
2424
cp -a /usr/src/influxdb-*/* /usr/bin/ && \
2525
rm -rf *.tar.gz* /usr/src /root/.gnupg && \
26-
apk del .build-deps
26+
apk del .build-deps && \
27+
addgroup -g 1000 influxdb && \
28+
adduser -G influxdb -u 1000 -S -h /var/lib/influxdb influxdb
2729
COPY influxdb.conf /etc/influxdb/influxdb.conf
2830

2931
EXPOSE 8086

influxdb/1.6/alpine/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ RUN set -ex && \
2323
chmod +x /usr/src/influxdb-*/* && \
2424
cp -a /usr/src/influxdb-*/* /usr/bin/ && \
2525
rm -rf *.tar.gz* /usr/src /root/.gnupg && \
26-
apk del .build-deps
26+
apk del .build-deps && \
27+
addgroup -g 1000 influxdb && \
28+
adduser -G influxdb -u 1000 -S -h /var/lib/influxdb influxdb
2729
COPY influxdb.conf /etc/influxdb/influxdb.conf
2830

2931
EXPOSE 8086

influxdb/1.7/alpine/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ RUN set -ex && \
2323
chmod +x /usr/src/influxdb-*/* && \
2424
cp -a /usr/src/influxdb-*/* /usr/bin/ && \
2525
rm -rf *.tar.gz* /usr/src /root/.gnupg && \
26-
apk del .build-deps
26+
apk del .build-deps && \
27+
addgroup -g 1000 influxdb && \
28+
adduser -G influxdb -u 1000 -S -h /var/lib/influxdb influxdb
2729
COPY influxdb.conf /etc/influxdb/influxdb.conf
2830

2931
EXPOSE 8086

influxdb/nightly/alpine/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ RUN set -ex && \
2121
chmod +x /usr/src/influxdb-*/* && \
2222
cp -a /usr/src/influxdb-*/* /usr/bin/ && \
2323
rm -rf *.tar.gz* /usr/src /root/.gnupg && \
24-
apk del .build-deps
24+
apk del .build-deps && \
25+
addgroup -g 1000 influxdb && \
26+
adduser -G influxdb -u 1000 -S -h /var/lib/influxdb influxdb
2527
COPY influxdb.conf /etc/influxdb/influxdb.conf
2628

2729
EXPOSE 8083 8086

0 commit comments

Comments
 (0)