Update docker.go

This commit is contained in:
Umer Farooq Mala 2024-11-19 22:07:17 +05:00 committed by GitHub
parent b08ee26027
commit a8b3b8a756
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -253,7 +253,7 @@ func (c *DockerCommand) GetContainers(existingContainers []*Container) ([]*Conta
}
newContainer.Container = ctr
// if the container is made with a name label we will use that
// if the container is made with a name then use that directly
if len(ctr.Names) > 0 && ctr.Names[0] != "" {
newContainer.Name = strings.TrimLeft(ctr.Names[0], "/")
} else if name, ok := ctr.Labels["name"]; ok {