3

Creating a Docker image from vmware/photon:2.0 I want to run the application inside that container as a user different than root. So, trying to create a new group and add user to it by following command:

groupadd -r new-group && useradd -r -g new-group new-user

It throws:

bash: groupadd: command not found

How can I achieve this?

Nitin Bhojwani
  • 702
  • 1
  • 5
  • 14

2 Answers2

3

You can install "shadow" package to be able to add groups/users.

tdnf -y install shadow
ramtech
  • 757
  • 6
  • 15
  • I had the same error as OP when trying to use groupadd on Photon 3 (minimal), and installing the `shadow` package resolved it. – Mackiavelli Jun 23 '23 at 11:49
0

this is not necessary with Photon:3.0. all the prerequisite tools are ready. That could be because I installed a dep package or was just there.

Richard
  • 10,122
  • 10
  • 42
  • 61
  • 1
    The photon:3.0 *docker image* doesn't seem to come with necessary tools by default. However, the full-fledged OS has necessary tools available in-built. So, when working with docker image of photon:3.0, I had to install the tools explicitly. – ramtech Nov 13 '19 at 15:43