testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

[Feature]: Add optional container user namespace for Ryku

Open scorpionknifes opened this issue 1 year ago • 1 comments

Problem

I'm working with a CI/CD environment that requires me to run Ryku with privileged and user namespace to be 'host'

I'm getting the following error when running Ryku in privileged mode, I need to manually pass in a user namespace.

docker: Error response from daemon: privileged mode is incompatible to user namespaces. You must run the container in the host namespace when running privileged mode'

Example docker cli:

docker run --privileged --userns host -it  -v /var/run/docker.sock:/var/run/docker.sock -p 8080 testcontainers/ryuk:0.8.1 sh

Solution

Create a option or config/env such as TESTCONTAINERS_RYUK_CONTAINER_USER_NAMESPACE to be configured to pass in as userns for Ryku

I'm currently have it successfully running with the following changes: https://github.com/mx51/testcontainers-go/commit/59dc7da8b5b20e2e7bceb976af059ba419af0f11

Benefit

Allow users to run Ryku in privileged mode with host namespace

Alternatives

Pass it in with an option to create a container.

Would you like to help contributing this feature?

Yes

scorpionknifes avatar Aug 06 '24 10:08 scorpionknifes