docker: Support starting as a non-root user (fixes #6832) (#6835)

This commit is contained in:
HansK-p 2020-07-14 11:38:59 +02:00 committed by GitHub
parent aedc2d788f
commit cd8e1ec738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -2,6 +2,10 @@
set -eu
chown "${PUID}:${PGID}" "${HOME}" \
&& exec su-exec "${PUID}:${PGID}" \
env HOME="$HOME" "$@"
if [ "$(id -u)" = '0' ]; then
chown "${PUID}:${PGID}" "${HOME}" \
&& exec su-exec "${PUID}:${PGID}" \
env HOME="$HOME" "$@"
else
exec "$@"
fi