Skip to content

Allow non-root server startup - #60

Open
Araeos wants to merge 2 commits into
indifferentbroccoli:mainfrom
Araeos:non-root-java
Open

Allow non-root server startup#60
Araeos wants to merge 2 commits into
indifferentbroccoli:mainfrom
Araeos:non-root-java

Conversation

@Araeos

@Araeos Araeos commented Aug 9, 2026

Copy link
Copy Markdown

Motivation

The image currently assumes it is started as root. Because of this, running it with Docker's -u option fails before the server can start.
At the same time, PUID and PGID are available as configuration options, but they don't control the user running the server. They are only used when handling some downloaded files. The Java server itself is still always run as root.
I can't speak for everyone, but I don't give my network services unnecessary root permissions.

Expected behavior

The container should be able to start directly as any user, for example:
docker run -u 1001:1001 ...
The server should then run as UID 1001 / GID 1001.
The user is responsible for making sure the storage locations are writable by that user. This ensures that privileged access is never used incorrectly/malicously

Actual behavior

Starting the container with a specific non-root user currently fails because the entrypoint expects root access.
When started normally, the entrypoint runs the Java server as root regardless of the configured PUID and PGID.

Changes

This PR removes PUID and PGID and changes the startup logic so it no longer requires root.
The container can now be started directly with Docker's -u option or Docker Compose's user: 1001:10001 setting and the server will run as that user.

Running as root is still possible, but must be explicitly enabled with the variable RUN_AS_ROOT=true RUN_AS_ROOT defaults to false.

So a normal non-root setup is simply:

sudo chown myuser:myuser ./server-files/ ./server-data/
docker run -u 1001:1001 ...

If the container is started as root without RUN_AS_ROOT=true, startup will fail with an error instead of silently running the server as root.

This is accomplished by allowing everyone write access to the container's home directory, but with the container isolation, I think this a worthwhile tradeoff when comparing it to giving the whole process root access.

Araeos added 2 commits August 9, 2026 18:26
The default requires non-root start, which can be disabled by setting RUN_AS_ROOT=true
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

Successfully merging this pull request may close these issues.

1 participant