Some of the links shared in this post are affiliate links. If you click on the link and make a purchase, we will receive an affiliate commission at no additional cost to you.
The PUID and PGID can be relevant for NFS and Docker containers. To determine the PUID (User ID) and PGID (Group ID) of the user under which Docker is running on a Linux system, proceed as follows:
1. find out the user name of the Docker process
First you need to find out the user name of the process under which Docker is running. You can do this with the following command:
ps aux | grep dockerd
This command lists all processes that have to do with dockerd
. In the output, you will see a column indicating the user name under which the Docker daemon is running. This is normally root
, but can also be another user if Docker has been set up with special authorizations.
2. determine user ID (PUID) and group ID (PGID)
After you have determined the user name, you can find out the PUID and PGID with the following command:
id <username>
Replace with the actual user name you found in the previous step.
Example:
If Docker is running as root
, enter :
id root
3rd edition understand
The output of the id command
looks something like this:
uid=0(root) gid=0(root) groups=0(root)
- PUID (User ID) is the number after
uid=
. - PGID (Group ID) is the number after
gid=
.
In this example, both the PUID and the PGID are 0
, which is typical for the root user
.
Summary
- Find the user name under which Docker is running with
ps aux | grep dockerd
. - Find out the PUID and PGID of this user with
id <username>
. - The PUID is the user ID
(uid=
) and the PGID is the group ID(gid=
).
This information can be useful when you start Docker containers and need specific user and group assignments, e.g. for file permissions.