Skip to content

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

@financelurker

Description

@financelurker

Hi, folks!

I recently started an Elixir project and due to my knowledge with Testcontainers in a Java Spring Boot application stack I stumbled over testcontainers-elixir and wanted to give it a try.

But registering testcontainers-elixir in my test_helper.exs I only gets me some :badarg error when executing mix test:
** (EXIT from #PID<0.99.0>) :badarg

What I already found out:

  • Testcontainers per se works on my machine in my Java Spring Boot application project.
  • This seems to be an issue in combination with SELinux. Because when temporarily disabling SELinux by using setenforce 0 then mix test actually runs without errors.
  • I added ryuk.container.privileged=true to my ~/.testcontainers.properties but this does not solve the issue.

ausearch output

sudo ausearch -m AVC,USER_AVC -ts recent
----
time->Fri May  9 07:07:26 2025
type=AVC msg=audit(1746767246.443:759): avc:  denied  { write } for  pid=82782 comm="ryuk" name="docker.sock" dev="tmpfs" ino=5634 scontext=system_u:system_r:container_t:s0:c331,c534 tcontext=system_u:object_r:container_var_run_t:s0 tclass=sock_file permissive=0
----
time->Fri May  9 07:07:26 2025
type=AVC msg=audit(1746767246.444:760): avc:  denied  { write } for  pid=82782 comm="ryuk" name="docker.sock" dev="tmpfs" ino=5634 scontext=system_u:system_r:container_t:s0:c331,c534 tcontext=system_u:object_r:container_var_run_t:s0 tclass=sock_file permissive=0

So... My main question would be: What would I need to do, to make testcontainers-elixir also runnable on a system with SELinux, like the testcontainers implementation for Java?

What other information do I need to provide here, that this issue can be resolved?

Edit / Add:

  • I am using docker-ce and not postman (so, I guess this is not in relation to this issue - or maybe it is, because there's also a mention of SELinux?)...
  • Having compared this repository with the testcontainers-dotnet one (because the other related issue I referenced here), I can see as difference that testcontainers-dotnet actually uses the ryuk.container.privileged value from ~/.testcontainers.properties and also respects the environment variable TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED - there's no mention of these attributes within this repository... (but also not quite sure if this is an indication of why this is not working for me, because testcontainers-java works without such a config)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions