Skip to content

Commit 23d2a81

Browse files
committed
feat(image): Use numeric USER value to be compatible with Kubernetes PodSecurityContext#runAsNonRoot
1 parent e7ee1be commit 23d2a81

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ RUN rm -r /etc/nginx/conf.d/ && ln -s "${CONFIG_DIR}/.out/conf.d" /etc/nginx/con
1919
RUN apk --no-cache add libcap && \
2020
setcap cap_net_bind_service=+ep /usr/sbin/nginx && \
2121
apk --no-cache del libcap
22-
USER nginx
22+
23+
# Needs to be set to numeric value to be compatible with Kubernetes PodSecurityContext#runAsNonRoot
24+
# Setting this to `nginx` and `runAsNonRoot: true` would result in runtime error:
25+
# "Error: container has runAsNonRoot and image has non-numeric user (nginx), cannot verify user is non-root"
26+
USER 101:101
2327

2428
ENTRYPOINT ["/docker-entrypoint.sh"]

0 commit comments

Comments
 (0)