Skip to content

feat(ryuk): honor ryuk.container.privileged property and env var#256

Merged
jarlah merged 1 commit into
mainfrom
fix/183-ryuk-privileged
Apr 22, 2026
Merged

feat(ryuk): honor ryuk.container.privileged property and env var#256
jarlah merged 1 commit into
mainfrom
fix/183-ryuk-privileged

Conversation

@jarlah
Copy link
Copy Markdown
Member

@jarlah jarlah commented Apr 22, 2026

Summary

  • Ryuk now runs in privileged mode when either the ryuk.container.privileged property (in ~/.testcontainers.properties) or the TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED environment 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.
  • When both sources are set, the environment variable takes precedence (matches dotnet).
  • The resolution logic is extracted into Testcontainers.ryuk_privileged?/1 so it can be exercised in unit tests without launching a real Ryuk container.

Test plan

  • mix compile
  • mix credo --strict
  • mix dialyzer
  • mix test (203 tests, 0 failures)
  • New unit tests in test/testcontainers_test.exs cover: 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 in on_exit and never start Ryuk.

Fixes #183

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
@jarlah jarlah merged commit 86fff90 into main Apr 22, 2026
8 of 9 checks passed
@jarlah jarlah deleted the fix/183-ryuk-privileged branch April 22, 2026 07:07
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.

testcontainers-elixir fails with :badarg but testcontainers-java works - Fedora 42 / SELinux

1 participant