JustaPenguin / assetto-server-manager

A web interface to manage an Assetto Corsa Server.
https://github.com/JustaPenguin/assetto-server-manager/releases
MIT License
276 stars 70 forks source link

Running container as non-default user on Linux requires manual file permission changes #1126

Open Jameskmonger opened 1 year ago

Jameskmonger commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

It's difficult to get the container to start successfully as the non-default user on Linux without manually changing file permissions to other users.

For example, the user that I want to run the Docker container has ID 1001. When I run the container, the container user has ID 1000 and therefore cannot work with the volume bound to /home/assetto/server-manager/assetto (which is owned by 1001, from the host).

To solve this, I had to manually change the ownership (on the host) of the /assetto volume and the config.yml file to user ID 1000 - but this is a different user.

To Reproduce Steps to reproduce the behavior:

  1. Create an Ubuntu user with an ID besides 1000
  2. Follow the readme to set up the server
  3. The server will fail (see Additional context for logs)

Expected behavior A way to run the container as a specific user without having to set ownership of files elsewhere

Possibly two build args USER_ID and GROUP_ID would help (see https://jtreminio.com/blog/running-docker-containers-as-current-host-user/)

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context

The error occurred attempting to: Open server manager storage (bolt or json)
The error more specifically is: mkdir assetto/manager: permission denied

I also got an error about creating server_manager.db but I didn't save the log.

requiem240sx commented 1 year ago

Here to say @Jameskmonger is correct, this is still an issue. I natively run my Docker with a different user and UID, not the standard 1000:1000. I tried setting the UUID andGUIDmultiple times with no luck to a user that has permissions... however the ENV VARS do nothing. After changing my folder permissions on my host withsudo chmod -R 1000:1000 /ac-server` it was finally able to download and get past the permissions issue.

Thanks for the find and creating a ticket, for sure helped me!