From ddaabed0ef04718934d34c7127d8ece905b4c366 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Tue, 4 Sep 2018 09:33:42 -0300 Subject: [PATCH] Fix binding to privileged ports 1 to 1023 --- rootfs/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index 1af40c3589..ea23d837e2 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -21,6 +21,7 @@ WORKDIR /etc/nginx RUN clean-install \ diffutils \ valgrind \ + libcap2-bin \ dumb-init COPY . / @@ -39,10 +40,18 @@ RUN bash -eu -c ' \ for dir in "${writeDirs[@]}"; do \ mkdir -p ${dir}; \ chown -R www-data.www-data ${dir}; \ + done \ + && for value in {1..1023};do \ + touch /etc/authbind/byport/$value; \ + chown www-data /etc/authbind/byport/$value; \ + chmod 755 /etc/authbind/byport/$value; \ done' \ && chown www-data.www-data /etc/nginx/nginx.conf \ && chown www-data.www-data /etc/nginx/opentracing.json +RUN setcap cap_net_bind_service=+ep /nginx-ingress-controller \ + && setcap -v cap_net_bind_service=+ep /nginx-ingress-controller + # Create symlinks to redirect nginx logs to stdout and stderr docker log collector # This only works if nginx is started with CMD or ENTRYPOINT RUN ln -sf /dev/stdout /var/log/nginx/access.log