Skip to content

Commit bcf5d27

Browse files
committed
chore: print Docker Info labels in banner
1 parent 4c5f1bd commit bcf5d27

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docker_client.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,27 @@ func (c *DockerClient) Info(ctx context.Context) (system.Info, error) {
5757
Server Version: %v
5858
API Version: %v
5959
Operating System: %v
60-
Total Memory: %v MB
60+
Total Memory: %v MB%s
6161
Testcontainers for Go Version: v%s
6262
Resolved Docker Host: %s
6363
Resolved Docker Socket Path: %s
6464
Test SessionID: %s
6565
Test ProcessID: %s
6666
`
67+
infoLabels := ""
68+
if len(dockerInfo.Labels) > 0 {
69+
infoLabels = `
70+
Labels:`
71+
for _, lb := range dockerInfo.Labels {
72+
infoLabels += "\n " + lb
73+
}
74+
}
6775

6876
Logger.Printf(infoMessage, packagePath,
69-
dockerInfo.ServerVersion, c.Client.ClientVersion(),
77+
dockerInfo.ServerVersion,
78+
c.Client.ClientVersion(),
7079
dockerInfo.OperatingSystem, dockerInfo.MemTotal/1024/1024,
80+
infoLabels,
7181
internal.Version,
7282
core.ExtractDockerHost(ctx),
7383
core.ExtractDockerSocket(ctx),

0 commit comments

Comments
 (0)