在我的开发盒上有这个限制是非常烦人的,因为除了我之外不会有任何用户.
我知道标准的解决方法,但它们都没有完全符合我的要求:
是否有一些简单的sysctl
变量允许非root进程绑定到Linux上的"特权"端口(端口小于1024),或者我只是运气不好?
编辑:在某些情况下,您可以使用功能来执行此操作.
我在 Docker 容器中运行 Nginx,出于安全原因,我希望尽可能多地删除 Linux 功能。
然后我可以放弃哪些能力?
该镜像类似于此处的标准 Docker Nginx Alpine 镜像:https : //github.com/nginxinc/docker-nginx/blob/0c7611139f2ce7c5a6b1febbfd5b436c8c7d2d53/mainline/alpine/Dockerfile,它以 root 身份启动 Nginx,然后以 root 身份运行工作进程用户'nginx',看:
root@instance-1:/opt/ed# docker-compose exec web bash
bash-4.3# # Now we're inside the container.
bash-4.3# ps aux
PID USER TIME COMMAND
1 root 0:00 /bin/sh -c /etc/nginx/run-envsubst.sh && nginx
10 root 0:00 nginx: master process nginx
11 nginx 0:00 nginx: worker process
12 nginx 0:00 nginx: cache manager process
14 root 0:00 bash
18 root 0:00 ps aux
Run Code Online (Sandbox Code Playgroud)
侦听端口 80 和 …