Skip to content

Commit

Permalink
feat: Log Docker daemon labels if present (#1226)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddumelendez authored Aug 6, 2024
1 parent 21137c6 commit 9a59b3e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Testcontainers/Clients/DockerApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9a59b3e

Please sign in to comment.