From 9e9e005114899e77ecd743aae34ac0c07f5585d1 Mon Sep 17 00:00:00 2001 From: Guilherme Freitas Date: Mon, 3 Feb 2025 13:07:19 -0300 Subject: [PATCH] Prioritize showing the container name over labels --- pkg/commands/docker.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg/commands/docker.go b/pkg/commands/docker.go index 28c12c23..13ec7be5 100644 --- a/pkg/commands/docker.go +++ b/pkg/commands/docker.go @@ -253,12 +253,8 @@ func (c *DockerCommand) GetContainers(existingContainers []*Container) ([]*Conta } newContainer.Container = ctr - // if the container is made with a name label we will use that - if name, ok := ctr.Labels["name"]; ok { - newContainer.Name = name - } else { - newContainer.Name = strings.TrimLeft(ctr.Names[0], "/") - } + + newContainer.Name = strings.TrimLeft(ctr.Names[0], "/") newContainer.ServiceName = ctr.Labels["com.docker.compose.service"] newContainer.ProjectName = ctr.Labels["com.docker.compose.project"] newContainer.ContainerNumber = ctr.Labels["com.docker.compose.container"]