You have the correct intuition.
Ports in the range 1-1024
need privileged permission to be bound. As you are starting nginx as a non-root user, you cannot bind nginx to listen on port 80.
Only way to fix this is to make Nginx listen on a non-privilege port >1024. To do this, you will need to feed a custom nginx.conf file. This should solve your immediate problem.
But there will be other permission issues down the line as nginx starts trying to access /var/log
to write logs, /var/tmp/
for temp files etc.
The best option is to use the non-root nginx docker image itself. https://hub.docker.com/r/nginxinc/nginx-unprivileged
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…