Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specific user for app #123

Open
karlkashofer opened this issue Feb 18, 2024 · 3 comments
Open

Add specific user for app #123

karlkashofer opened this issue Feb 18, 2024 · 3 comments

Comments

@karlkashofer
Copy link

I am trying to move a old legacy java app into docker and need to set up a specific user account inside the container as this account is hardcoded in the configs of the program that i want to move. If i try to start it as the default app user it complains about missing files and crashes.

I can run the program manually inside the container by interactively adding the user (adduser), chowning the /home/user folder where i copied the legacy app and its config and starting the app with "su user program". Then the program starts and is usable via the web interface.
I fail to reproduce these interactive steps with startapp.sh (no permission for adduser) or in the docker build file (apparently users added during docker build are removed during container startup).

Any ideas how to get that working ?

@jlesage
Copy link
Owner

jlesage commented Feb 18, 2024

Is the app looking for a specific UID or just a username in /etc/passwd ?

@karlkashofer
Copy link
Author

I dont know.
Its a java 8/netbeans app for configuring the alarm system of my house. I very rarely use it and it does not run on recent debian, so i would like to run it from the container.

I cant put everything in /home/app that does not work, apparently the config contains folder names.

If i start it as a different user it gets to the installation screen, so it is not finding the config. I need it to use the existing config. It was set up when the alarm system was installed. Its a gruesome java app, basically nonsensical translations from italian and really weird windowing system. But its all i have, and i can reset alarms and see error messages in there.

I would really need the /home/karl/ folder and i think i also need the starting user to be karl. :)

@jlesage
Copy link
Owner

jlesage commented Feb 20, 2024

Ok. In any case, you can setup things during startup of the container as root by using an init script (e.g. /etc/cont-init.d/55-app.sh).

Starting the app via startapp.sh is always done under the user configured via USER_ID and GROUP_ID. I guess you will have to setup the karl user with these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants