diff --git a/src/Testcontainers/Clients/DockerApiClient.cs b/src/Testcontainers/Clients/DockerApiClient.cs index f0436a287..927bb397a 100644 --- a/src/Testcontainers/Clients/DockerApiClient.cs +++ b/src/Testcontainers/Clients/DockerApiClient.cs @@ -119,7 +119,7 @@ await RuntimeInitialized.WaitAsync(ct) } Logger.LogInformation("{RuntimeInfo}", runtimeInfo); } - catch(Exception e) + catch (Exception e) { Logger.LogError(e, "Failed to retrieve Docker container runtime information"); } diff --git a/src/Testcontainers/Clients/TestcontainersClient.cs b/src/Testcontainers/Clients/TestcontainersClient.cs index cf93eac58..c7ddeb8ca 100644 --- a/src/Testcontainers/Clients/TestcontainersClient.cs +++ b/src/Testcontainers/Clients/TestcontainersClient.cs @@ -311,7 +311,9 @@ public async Task RunAsync(IContainerConfiguration configuration, Cancel { ImageInspectResponse cachedImage; - if (TestcontainersSettings.ResourceReaperEnabled && ResourceReaper.DefaultSessionId.Equals(configuration.SessionId)) + if (TestcontainersSettings.ResourceReaperEnabled + && ResourceReaper.IsUnavailable + && ResourceReaper.DefaultSessionId.Equals(configuration.SessionId)) { var isWindowsEngineEnabled = await System.GetIsWindowsEngineEnabled(ct) .ConfigureAwait(false); diff --git a/src/Testcontainers/Containers/ResourceReaper.cs b/src/Testcontainers/Containers/ResourceReaper.cs index 70d672871..6e7a32bb5 100644 --- a/src/Testcontainers/Containers/ResourceReaper.cs +++ b/src/Testcontainers/Containers/ResourceReaper.cs @@ -33,7 +33,7 @@ public sealed class ResourceReaper : IAsyncDisposable /// private const int RetryTimeoutInSeconds = 2; - private static readonly IImage RyukImage = new DockerImage("testcontainers/ryuk:0.12.0"); + private static readonly IImage RyukImage = new DockerImage("testcontainers/ryuk:0.14.0"); private static readonly SemaphoreSlim DefaultLock = new SemaphoreSlim(1, 1); @@ -90,6 +90,13 @@ private ResourceReaper(Guid sessionId, IDockerEndpointAuthenticationConfiguratio public static Guid DefaultSessionId { get; } = Guid.NewGuid(); + /// + /// Gets a value indicating whether the default instance is running and available. + /// + [PublicAPI] + public static bool IsUnavailable + => _defaultInstance == null || _defaultInstance._disposed; + /// /// Gets the session id. /// diff --git a/tests/Testcontainers.Commons/CommonImages.cs b/tests/Testcontainers.Commons/CommonImages.cs index 6d3eccf36..1bedca952 100644 --- a/tests/Testcontainers.Commons/CommonImages.cs +++ b/tests/Testcontainers.Commons/CommonImages.cs @@ -3,7 +3,7 @@ namespace DotNet.Testcontainers.Commons; [PublicAPI] public static class CommonImages { - public static readonly IImage Ryuk = new DockerImage("testcontainers/ryuk:0.12.0"); + public static readonly IImage Ryuk = new DockerImage("testcontainers/ryuk:0.14.0"); public static readonly IImage HelloWorld = new DockerImage("testcontainers/helloworld:1.2.0");