Fix: Avoid failing startup when chown is not permitted on bind mounts#24
Open
tilwegener wants to merge 2 commits into
Open
Fix: Avoid failing startup when chown is not permitted on bind mounts#24tilwegener wants to merge 2 commits into
tilwegener wants to merge 2 commits into
Conversation
Added capabilities CHOWN, SETUID, and SETGID to the Docker configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The container currently attempts to
chownthe configured data directory (/app/data) during startup based on the configuredPUIDandPGID.On some environments this causes the container to fail during startup with:
Affected environments
This can happen when running with:
cap_drop: ALL(withoutCAP_CHOWN)Even when the bind-mounted directory is already owned by the correct UID/GID, the container still attempts to perform a recursive
chown.Expected behavior
If the configured directory is already writable by the application user, the container should continue starting without attempting to change ownership.
If ownership cannot be changed, the startup should emit a warning instead of terminating, allowing the application to run when permissions are already sufficient.
Possible solutions
chownwhen the directory is already owned by the configured UID/GID.EPERM/Operation not permittederrors.DISABLE_CHOWN=trueorSKIP_CHOWN=true).Reproduction
Using a bind mount:
with:
results in:
The directory on the host is already owned by the configured user/group:
The application would be able to access the directory, but startup fails because the unconditional
chownreturns an error.Additional notes
Making the ownership adjustment optional would improve compatibility with a variety of container runtimes and storage backends while maintaining the current behavior as the default.