jlesage / docker-baseimage-gui

A minimal docker baseimage to ease creation of X graphical application containers
MIT License
1.2k stars 179 forks source link

Add specific user for app #123

Open karlkashofer opened 9 months ago

karlkashofer commented 9 months ago

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 commented 9 months ago

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

karlkashofer commented 9 months ago

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 commented 9 months ago

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.