jsknnr / enshrouded-server

Run Enshrouded dedicated server in a container
MIT License
185 stars 23 forks source link

Possibility to Change UID and GID #51

Closed fetpols closed 2 months ago

fetpols commented 8 months ago

I'm testing on a Synology NAS, and everything works perfectly except for the game save feature. Synology doesn't allow changing the UID and GID of modified users through the console. I've seen other ways to force it, but I'd prefer not to tinker too much with the system. Is there any way to choose different UID and GID? Thank you very much

jsknnr commented 8 months ago

My image runs as non root with UID:GID of 10000 for security and to avoid host ID collisions. This is best practice. However, if you absolutely need to change the UID:GID for the container, you can build the image your self. My image will never run as root as that is not how I build images, so there is no way for me through start env vars to change UID:GID. I have however added the ability for it to be specified on image build.

Grab all the files for the image you want to build (wine/proton) from my repo (or just clone the repo) from /container/ directory. Once you have all the files, go to that directory locally and:

docker build --build-arg="CONTAINER_UID=N" --build-arg="CONTAINER_GID=N" -t my-enshrouded:latest .

Once the build is finished, you can then run with your custom built image. If you're running compose or docker directly or whatever, just change the image and tag to match your new built container which in the above example would be my-enshrouded:latest

Cheers,

fetpols commented 8 months ago

Wow, that was a really good explanation, I appreciate it. It worked perfectly for me

jsknnr commented 8 months ago

Glad to hear it. Have fun.