小编Bil*_*saf的帖子

错误:仅当主进程以超级用户权限运行时,“user”指令才有意义

您好,当我尝试在 dockerfile 中实现新用户而不是使用 root 用户时,出现以下错误。

2020-10-16T09:28:04.554363522Z nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:5
2020-10-16T09:28:04.564383012Z nginx: [emerg] mkdir() "/var/lib/nginx/tmp/client_body" failed (13: Permission denied)
2020-10-16T09:28:06.882365055Z nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:5
2020-10-16T09:28:06.891084727Z nginx: [emerg] mkdir() "/var/lib/nginx/tmp/client_body" failed (13: Permission denied)
2020-10-16T09:28:09.331807870Z nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, …
Run Code Online (Sandbox Code Playgroud)

permissions bash nginx docker dockerfile

17
推荐指数
2
解决办法
4万
查看次数

nginx:[emerg] open()“/run/nginx.pid”失败(13:权限被拒绝)

我有以下 Dockerfile,我已将其设置为使用新用户而不是使用 root 作为我的 nginx 服务器。nginx 服务器基于 Redhat UBI 镜像构建。图像构建良好,但是当我运行容器时,出现以下错误: nginx: [nginx: [emerg] open() "/run/nginx.pid" failed (13: Permission returned)

下面是我的 dockerfile。

USER root
RUN microdnf --setopt=tsflags=nodocs install -y nginx procps shadow-utils net-tools ca-certificates dirmngr gnupg wget vim\
            && microdnf clean all \
            && rpm -q procps-ng

ENV NGINX_USER="api-gatway" \
    NGINXR_UID="8987" \
    NGINX_GROUP="api-gatway" \
    NGINX_GID="8987"     

RUN set -ex; \
  groupadd -r --gid "$NGINX_GID" "$NGINX_GROUP"; \
  useradd -r --uid "$NGINXR_UID" --gid "$NGINX_GID" "$NGINX_USER" 


COPY nginx.conf /etc/nginx/nginx.conf

RUN mkdir -p /var/lib/nginx/tmp /var/log/nginx \ …
Run Code Online (Sandbox Code Playgroud)

nginx docker kubernetes dockerfile kubernetes-helm

6
推荐指数
1
解决办法
2万
查看次数