Need #nginx to run as non-root? Just use the unprivileged #docker image.
FROM nginxinc/nginx-unprivileged:1.27.2-alpine
WORKDIR /
COPY ./my-html /usr/share/nginx/html/
COPY ./nginx.conf /etc/nginx/nginx.conf
Since non-root can't use :80
, the above image defaults to :8080
, so any
nginx
configuration will need to reflect that, as well as any other
infrastructure, like istio
or kubernetes
.
# nginx.conf
worker_processes 1;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
}
}