Hey everyone! I'm new to using Docker and self-hosting, and I'm struggling to grasp how to set up PUID and PGID. I get the basics of user permissions and why they're important, but I'm confused about the practical steps to create a new user and adjust its permissions. From my understanding, I need to run some commands, but I'm not sure how to access the shell for that. Is this process happening on the underlying kernel where I create the user, and then the containers use that user? It feels like I'm missing a lot of foundational knowledge here, so any guidance would be super helpful!
3 Answers
To set up PUID and PGID, you actually need to do this inside the WSL distro that Docker Desktop creates for you. Just to clarify, it's important to note that PUID and PGID aren't Docker-specific; they relate more to the Linux environment. Once you're inside WSL, you can create a new user and manage its permissions with standard Linux commands. If you need pointers on how to access WSL or create users, let me know!
Understanding PUID and PGID can be complex since they aren't standard Docker features. They're environment variables utilized by some Docker images. Essentially, these variables tell the image to modify its user ID and group ID at runtime. The USER instruction in a Dockerfile specifies which user the container runs as, but this setup starts with your host system's user management. If you need further details, please provide more context about your project!
If you're using Docker on Windows with WSL2, then yes, you'll want to create the user and handle the permissions via WSL2. This is where you should determine the PUID and PGID for the user you create. Remember, while Docker containers may have their own user management, they typically adhere to the host's user system, which in this case is being managed through WSL. Make sure to get familiar with WSL commands to make this easier!

Related Questions
How To Get Your Domain Unblocked From Facebook
How To Find A String In a Directory of Files Using Linux