-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it possible to turn off Ryuk with an environment variable #1181
Conversation
if (ryukContainerId != null) { | ||
checkDiskSpace(client, ryukContainerId); | ||
} else { | ||
runInsideDocker( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice that we can still run the checks without a long-lived Ryuk container!
This looks pretty much fine to me overall, thank you. Just a few more things:
|
@rnorth I think the most essential way would be to run Testcontainers tests on Bitbucket :D |
I'd be fine with merging this and add an issue for adding a CI test for this, so we can give the Bitbucket guys a solution quickly 🙂 |
Just tried this out in bitbucket pipelines with the snapshot build. Works great. Thanks for this @bsideup. |
Released in 1.10.6 |
@bsideup i was struggling at work to make the build running on a remote DOCKER_HOST and couldn't bring it to run until i used the environment variable Now i am wondering why in ResourceReaper#70 i see the bind hardcoded
In this way when running on a remote host, the ryuk container can't be spawned (since it tries to connect to Wouldn't it make more sense to take the volume to be used from an environment variable (instead of hardcoding it) ? BTW what are the consequences of not using ryuk in the test which depend on testcontainers containers? |
Hi @mariusneo, When not using Ryuk, resources created by Testcontainers (containers, volumes, networks) might not be cleaned up in case of JVM crash or termination with e.g. SIGKILL. |
Thanks for the heads-up @kiview. Does it make sense to have a configurable binding for ryuk (as I've mentioned over a If yes, I could do a pull request for such a change . I'll try this scenario on my workstation tomorrow and if it works I'll make a corresponding PR for it. |
@kiview i had a look on this issue again in ResourceReaper.java
Is there an elegant way to receive the docker host programmatically to use it in the above referenced binding ? Through debugging i came across
which is obviously not good enough. I'd like to get the docker host before making the Could anybody give me a hint in this direction? |
@mariusneo the host you get (on your machine) might not be (and most probably will not be) the same as inside a container started by the daemon (the same applies to |
@bsideup i've tested the following scenario: The project uses for testing testcontainers reason why I am sending the DOCKER_HOST to be used for test purposes as a --build-arg. The docker host is exposing a tcp interface (and not a sock one) reason why I am trying to overwrite the binding in the ResourceReaper with a dynamic value. I guess that by dynamically setting the binding volume to the dockerHost from the dockerClientConfig I wouldn't receive anymore the errors that I currently receive if I don't set TESTCONTAINERS_RYUK_DISABLED to true |
Are you talking about using Testcontainers in running container, based on your image, or are you referring to using Testcontainers as part of your docker build? |
@kiview and @bsideup as mentioned yesterday, I'm posting a simple project that can be used to showcase the problem I'm pointing to. I've made a thorough documentation of the problem that I'm facing in the following project (a proof of concept containing one https://github.com/mariusneo/dockerized-maven-build TLDR: ryuk can't be accessed when
Thanks in advance for taking the time to investigate this problem. |
Thanks for the very detailed example @mariusneo. I think this use case has never been a top priority for us, but seeing that it's already achievable in the current state without using Ryuk, makes me consider it again. |
@mariusneo could you please explain why the remote Docker does not expose the unix socket? |
To turn it off, set
TESTCONTAINERS_RYUK_DISABLED
environment variable totrue
.Closes #1023 #700.