feat(ryuk): honor ryuk.container.privileged property and env var#256
Merged
Conversation
Mirror testcontainers-dotnet behavior and resolve SELinux denials on Fedora (issue #183) by letting users run Ryuk in privileged mode via either the `ryuk.container.privileged` property in `~/.testcontainers.properties` or the `TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED` environment variable. Both `"true"` and `"1"` are treated as truthy. The environment variable takes precedence over the property when both are set, matching the dotnet implementation. The resolver is extracted as `Testcontainers.ryuk_privileged?/1` (@doc false) so it can be unit-tested without launching Ryuk. Fixes #183
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
ryuk.container.privilegedproperty (in~/.testcontainers.properties) or theTESTCONTAINERS_RYUK_CONTAINER_PRIVILEGEDenvironment variable is truthy ("true"or"1"). This mirrors the behavior in testcontainers-dotnet and resolves SELinux denials on Fedora 42 when Ryuk writes to the Docker socket.Testcontainers.ryuk_privileged?/1so it can be exercised in unit tests without launching a real Ryuk container.Test plan
mix compilemix credo --strictmix dialyzermix test(203 tests, 0 failures)test/testcontainers_test.exscover: unset, property truthy (true,1), property falsy (false,0, arbitrary strings, empty), env var truthy/falsy, env-var-wins precedence in both directions, and case/whitespace handling. Tests snapshot/restore the env var inon_exitand never start Ryuk.Fixes #183