每次我尝试以非root用户身份运行容器时,都会得到以下错误:
the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:2Dockerfile:
FROM nginx:1.17.6
RUN chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
chown -R nginx:nginx /etc/nginx/conf.d
RUN chmod -R 777 /etc/nginx/conf.d
USER nginx
COPY app/build /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx/nginx.conf /etc/nginx/conf.d
CMD ["nginx","-g","daemon off;"]发布于 2020-11-04 20:09:40
使用来自nginx的无根docker-imager。
镜像
nginxinc/nginx-unprivileged DockerHub
https://hub.docker.com/r/nginxinc/nginx-unprivileged
GitHub
发布于 2020-07-27 17:34:15
您可以删除(或注释) nginx.conf文件顶部的user指令。
当您以root身份运行nginx时,此指令是相关的。它定义拥有nginx子进程的pid的用户。
当您不以root身份运行nginx时,此指令无关紧要,您的nginx子进程将使用当前用户运行。
https://stackoverflow.com/questions/63108119
复制相似问题