Skip to content

Commit 9485bc3

Browse files
author
Sebastian Spaink
committed
fix: use su
1 parent d87251c commit 9485bc3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

telegraf/nightly/alpine/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM alpine:3.14
22

33
RUN echo 'hosts: files dns' >> /etc/nsswitch.conf
4-
RUN apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors tzdata && \
4+
RUN apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors tzdata su-exec && \
55
update-ca-certificates
66

77

telegraf/nightly/entrypoint.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
#!/bin/bash
1+
#!/bin/sh
22
set -e
33

44
if [ "${1:0:1}" = '-' ]; then
55
set -- telegraf "$@"
66
fi
77

8-
exec "$@"
8+
if [ "$(id -u)" -ne 0 ]; then
9+
exec "$@"
10+
else
11+
exec su-exec telegraf "$@"
12+
fi

0 commit comments

Comments
 (0)