From 1ef5cd98872e8cb49557f9955f1cd63dfeb2dcdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Mon, 5 Aug 2024 16:33:23 -0500 Subject: [PATCH] Log docker daemon labels if present Docker Engine can be configured to have labels. --- src/Testcontainers/Clients/DockerApiClient.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Testcontainers/Clients/DockerApiClient.cs b/src/Testcontainers/Clients/DockerApiClient.cs index 826b18b58..46dc3aad3 100644 --- a/src/Testcontainers/Clients/DockerApiClient.cs +++ b/src/Testcontainers/Clients/DockerApiClient.cs @@ -107,8 +107,19 @@ await RuntimeInitialized.WaitAsync(ct) runtimeInfo.AppendLine(dockerInfo.OperatingSystem); runtimeInfo.Append(" Total Memory: "); - runtimeInfo.AppendFormat(CultureInfo.InvariantCulture, "{0:F} {1}", dockerInfo.MemTotal / Math.Pow(1024, byteUnits.Length), byteUnits[byteUnits.Length - 1]); + runtimeInfo.AppendLine(String.Format(CultureInfo.InvariantCulture, "{0:F} {1}", dockerInfo.MemTotal / Math.Pow(1024, byteUnits.Length), byteUnits[byteUnits.Length - 1])); + var labels = dockerInfo.Labels; + if (labels != null && labels.Count > 0) + { + runtimeInfo.AppendLine(" Labels: "); + + foreach (var label in labels) + { + runtimeInfo.Append(" "); + runtimeInfo.AppendLine(label); + } + } Logger.LogInformation("{RuntimeInfo}", runtimeInfo); } catch(Exception e)