You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes containers need to execute some shut down logic. In the code I can override a lifecycle method, something like containerIsStopping in Testcontainers-java for example and execute custom shutdown logic.
But if my containers are garbage collected by Ryuk, it's currently impossible (or very hard) to provide a shutdown logic.
I'd like to be able to register a shutdown hook for Ryuk, it can be as simple as enabling the behavior and Ryuk checking for a particular file path and running that file if exists before killing the container.
This will allow me:
enable shutdown hooks in Ryuk
copy the script with the shutdown logic into the container
override the containerIsStopping with calling the same file in the container
And my containers will clean up resources whether they are stopped by code or Ryuk.
The text was updated successfully, but these errors were encountered:
Sometimes containers need to execute some shut down logic
Do you have examples?
But if my containers are garbage collected by Ryuk, it's currently impossible (or very hard) to provide a shutdown logic.
The idea is that Ryuk should kill containers, not gracefully stop them. Any graceful shutdown should be done explicitly in the tests. But maybe I am missing some valid use case?
@shelajev in tc-go there are PreTerminates and PostTerminate hooks, which are called in the Go test program. So if you are used to using ctr.Terminate(ctx) in your Go tests, then you benefit from using those hooks.
I agree with @bsideup here, as Ryuk is just the messenger 🤷
Sometimes containers need to execute some shut down logic. In the code I can override a lifecycle method, something like
containerIsStopping
in Testcontainers-java for example and execute custom shutdown logic.But if my containers are garbage collected by Ryuk, it's currently impossible (or very hard) to provide a shutdown logic.
I'd like to be able to register a shutdown hook for Ryuk, it can be as simple as enabling the behavior and Ryuk checking for a particular file path and running that file if exists before killing the container.
This will allow me:
containerIsStopping
with calling the same file in the containerAnd my containers will clean up resources whether they are stopped by code or Ryuk.
The text was updated successfully, but these errors were encountered: