macbre / docker-nginx-http3

Stable and up-to-date root-less nginx with quic + http/3, google brotli compression, njs, GeoIP2, and Grade A+ SSL config
https://hub.docker.com/r/macbre/nginx-http3
159 stars 52 forks source link

/var/log/nginx/error.log" failed (13: Permission denied) #138

Open jobe451 opened 1 month ago

jobe451 commented 1 month ago

I just do not get this image to run, something with permissions is wrong.

docker logs nginx

I keep getting:

nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2024/05/18 01:14:09 [emerg] 1#1: open() "/var/log/nginx/error.log" failed (13: Permission denied)

I do use this compose file on ubuntu 24.04. /docker/nginx and its subdirectory are all used by user/group nginx:nginx; uid/gid: 1002:1002.

services:
  nginx:
    image: macbre/nginx-http3
    build:
      context: ./nginx/
      args:
        NGINX_USER_UID: 1002
        NGINX_GROUP_GID: 1002
    environment:
      NGINX_USER_UID: 1002
      NGINX_GROUP_GID: 1002
    container_name: nginx
    user: nginx
    volumes:
     - /docker/nginx/etc/conf.d:/etc/nginx/conf.d/:ro
     - /docker/nginx/etc/main.d:/etc/nginx/main.d/:ro
     - /docker/nginx/html:/var/www/html:ro
     - /docker/nginx/logs:/var/log/nginx/:rw
    ports:
      - '80:80/tcp'

What am I doing wrong?

macbre commented 3 weeks ago
    user: nginx

Did you try passing the numeric uid/gid pair here? nginx user may have a different uid on your host and inside the nginx container.