coppit / docker-inotify-command

Watch a folder for changes, and run a command in response
GNU Lesser General Public License v2.1
35 stars 32 forks source link

groupadd/useradd command not found #8

Open grahamPegNetwork opened 3 years ago

grahamPegNetwork commented 3 years ago

I'm not sure where the issue is, but it seems I ran into some issues with the runas.sh script as follows:

inotify    | /files/runas.sh: line 82: groupadd: command not found
inotify    | /files/runas.sh: line 83: useradd: command not found
inotify    | chown: unknown user/group user_1000_1000:group_1000_1000
inotify    | [2021-02-12 08:12:20] Running command as user "user_1000_1000"...
inotify    | setuser: user user_1000_1000 not found

I set user/group IDs to 1000 as that is my current user, everything else is fairly normal in the config file from what I can tell. Right now I'm just trying to run a test, outputting anything to a local file.

pdahlman commented 3 years ago

This is due to commit https://github.com/coppit/docker-inotify-command/commit/e65260ff523b4637b4b511229f2d8e6a936d6b4b where base image was changed to Alpine. As Alpine uses adduser/addgroup instead of useradd/groupaddg, the commands used in runas.sh can't be found.

The script needs updating or you have to add user/group, in the container, with the same id as is used on the host. If the id exist, runas.sh won't try to create a new user/group.