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

Can I set uid and gid for the internal user? #99

Closed Scarecrow928 closed 3 weeks ago

Scarecrow928 commented 1 year ago

It seems that nginx will not run as root, so can I set uid and gid for the internal user? for example like linuxserver passing env variables PGID and PUID? Really need this😭

Scarecrow928 commented 1 year ago

ok I can simply do this with the docker run flag --user:

docker run --user=1000:1000 macbre/nginx-http3 ash

or the compose argument user:

version: "3"
services:
  nginx:
    image: macbre/nginx-http3
    user: root
    container_name: nginx
    ports:
      - 80:80
      - 443:443
      - 443:443/udp
    volumes:
      - ./nginx/https.conf:/etc/nginx/conf.d/https.conf
      - ./log:/var/log/nginx
      - ./www:/var/www
    restart: unless-stopped

Letting the users decide the UID and GID may be a better choice

victor-sm commented 8 months ago

I had the same need:

123 Added uid and gid ARG for nginx user