/// <inheritdoc /> public async Task <string> RunAsync(ITestcontainersConfiguration configuration, CancellationToken ct = default) { // TODO: Workaround until we have a Windows Docker image of Ryuk var isWindowsEngineEnabled = await this.GetIsWindowsEngineEnabled(ct) .ConfigureAwait(false); if (!isWindowsEngineEnabled && ResourceReaper.DefaultSessionId.ToString("D").Equals(configuration.Labels[ResourceReaper.ResourceReaperSessionLabel], StringComparison.OrdinalIgnoreCase)) { _ = await ResourceReaper.GetAndStartDefaultAsync(configuration.DockerEndpointAuthConfig, ct) .ConfigureAwait(false); } if (!await this.images.ExistsWithNameAsync(configuration.Image.FullName, ct) .ConfigureAwait(false)) { var authConfig = default(DockerRegistryAuthenticationConfiguration).Equals(configuration.DockerRegistryAuthConfig) ? this.registryAuthenticationProvider.GetAuthConfig(configuration.Image.GetHostname()) : configuration.DockerRegistryAuthConfig; await this.images.CreateAsync(configuration.Image, authConfig, ct) .ConfigureAwait(false); } var id = await this.containers.RunAsync(configuration, ct) .ConfigureAwait(false); return(id); }
public async Task InitializeAsync() { if (Docker.Exists(DockerResource.Container, DefaultRyukContainerName)) { var resourceReaper = await ResourceReaper.GetAndStartDefaultAsync() .ConfigureAwait(false); await resourceReaper.DisposeAsync() .ConfigureAwait(false); } }