Skip to content

Commit 54b6ab3

Browse files
committed
run as non privileged user for security
1 parent 67a81cf commit 54b6ab3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ ADD entrypoint.sh /entrypoint.sh
3434
ADD create_ca_cert.sh /create_ca_cert.sh
3535
RUN chmod +x /create_ca_cert.sh /entrypoint.sh
3636

37+
# Allow running nginx with unprivileged user
38+
RUN chown 1000:1000 /etc/nginx && \
39+
mkdir /certs && chown 1000:1000 /certs
40+
41+
USER 1000:1000
42+
3743
# Clients should only use 3128, not anything else.
3844
EXPOSE 3128
3945

@@ -53,4 +59,4 @@ ENV DEBUG="false"
5359
ENV DEBUG_NGINX="false"
5460

5561
# Did you want a shell? Sorry, the entrypoint never returns, because it runs nginx itself. Use 'docker exec' if you need to mess around internally.
56-
ENTRYPOINT ["/entrypoint.sh"]
62+
ENTRYPOINT ["/entrypoint.sh"]

0 commit comments

Comments
 (0)