From a7915d877c5307d71ff82b53ead69f36c6063f5f Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Mon, 14 Oct 2024 11:43:36 -0500 Subject: [PATCH] Adjust Beats container user to be numeric. (#41197) Signed-off-by: Michael Montgomery --- dev-tools/packaging/templates/docker/Dockerfile.tmpl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dev-tools/packaging/templates/docker/Dockerfile.tmpl b/dev-tools/packaging/templates/docker/Dockerfile.tmpl index 85904ffe5dd..d5696e9fa0e 100644 --- a/dev-tools/packaging/templates/docker/Dockerfile.tmpl +++ b/dev-tools/packaging/templates/docker/Dockerfile.tmpl @@ -205,7 +205,7 @@ RUN cd /usr/share/heartbeat/.node \ && curl ${NODE_DOWNLOAD_URL} | tar -xJ --strip 1 -C node \ && chmod ug+rwX -R $NODE_PATH -# Install synthetics as a regular user, installing npm deps as root odesn't work +# Install synthetics as a regular user, installing npm deps as root doesn't work RUN chown -R {{ .user }} $NODE_PATH USER {{ .user }} # If this fails dump the NPM logs @@ -227,7 +227,11 @@ done; \ (exit $exit_code) {{- end }} -USER {{ .user }} +{{- if eq .user "root" }} +USER 0 +{{- else }} +USER 1000 +{{- end }} {{- range $i, $port := .ExposePorts }} EXPOSE {{ $port }}