Add SKIP_CHOWN_DATA to skip the "Changing ownership of /data" (#3103)

This commit is contained in:
Geoff Bourne 2024-10-13 15:05:49 -05:00 committed by GitHub
parent f5da624789
commit afbdfea0bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -3,3 +3,5 @@ To troubleshoot the container initialization, such as when server files are pre-
To troubleshoot just the command-line used to start the Minecraft server, set the environment variable `DEBUG_EXEC` to `true`.
To troubleshoot any issues with memory allocation reported by the JVM, set the environment variable `DEBUG_MEMORY` to `true`.
If you are experiencing any issues with the "Changing ownership of /data" step, that can be disabled by setting `SKIP_CHOWN_DATA` to `true`.

View file

@ -6,6 +6,7 @@
# The Dockerfile ENVs take precedence here, but defaulting for testing consistency
: "${UID:=1000}"
: "${GID:=1000}"
: "${SKIP_CHOWN_DATA:=false}"
umask "${UMASK:=0002}"
@ -38,7 +39,7 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ "$(id -u)" = 0 ]; then
fi
fi
if [[ $(stat -c "%u" /data) != "$UID" ]]; then
if isTrue "${SKIP_CHOWN_DATA}" || [[ $(stat -c "%u" /data) != "$UID" ]]; then
log "Changing ownership of /data to $UID ..."
chown -R ${runAsUser}:${runAsGroup} /data
fi