Inside a docker container, if I type groups it works and gives 'root' in the result but when I type groups <username> it says groups: '<username>': no such user. What is the reason for this behavior?
1 Answer
To get your locally configured groups (and users) into the container, you would mount /etc/passwd and /etc/groups into it.
In your case there is LDAP involved. You should add information how it is integrated on your host. You could have a look if your LDAP integration syncs into the /etc/groups and /etc/passwd files on your host.
groupswithout supplying user argument returns the groups to which the current user belongs. In your case therootgroup. It appears that the username you supplied in call withusernamedoes not exist.usersreturns the list of available users in your system.