mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Update docker.go
This commit is contained in:
parent
de40167712
commit
b08ee26027
1 changed files with 4 additions and 2 deletions
|
|
@ -254,10 +254,12 @@ 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 {
|
||||
if len(ctr.Names) > 0 && ctr.Names[0] != "" {
|
||||
newContainer.Name = strings.TrimLeft(ctr.Names[0], "/")
|
||||
} else if name, ok := ctr.Labels["name"]; ok {
|
||||
newContainer.Name = name
|
||||
} else {
|
||||
newContainer.Name = strings.TrimLeft(ctr.Names[0], "/")
|
||||
newContainer.Name = "default_name"
|
||||
}
|
||||
newContainer.ServiceName = ctr.Labels["com.docker.compose.service"]
|
||||
newContainer.ProjectName = ctr.Labels["com.docker.compose.project"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue