Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added uid and gid ARG for nginx user #123

Merged
merged 1 commit into from
Oct 18, 2023
Merged

Added uid and gid ARG for nginx user #123

merged 1 commit into from
Oct 18, 2023

Conversation

victor-sm
Copy link

@victor-sm victor-sm commented Oct 18, 2023

Added ARG variables to easily set a different uid, gid for the nginx user.

Example usage with a docker compose file:

services:
  nginx:
    build: 
      context: ./nginx/
      args:
        NGINX_USER_UID: 50010
        NGINX_GROUP_GID: 50010
    restart: always
    ports:
      - 80:8080
      - 443:8443
      - 443:8443/udp
     [...]

Since this build is running nginx as a non-root user, I had problems accessing certs created by certbot (which runs as root). By setting a custom uid/gid at build corresponding to a user on the host system, I could then give nginx permission using Access Control list (ACL) to the cert volume, thus allowing it to read the files.

Based on this guide.

Added ARG variables to easily set a different uid, gid for the nginx user.
@victor-sm
Copy link
Author

Would also solve:

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

@macbre
Copy link
Owner

macbre commented Oct 18, 2023

@victor-sm - welcome and thanks for the PR!

@macbre macbre merged commit 8f14b0f into macbre:master Oct 18, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants