mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
set the service name in getContainers
Signed-off-by: Dowideit, Sven (O&A, St. Lucia) <Sven.Dowideit@csiro.au>
This commit is contained in:
parent
2f28baa52d
commit
510b4b9ad6
1 changed files with 9 additions and 7 deletions
|
|
@ -240,16 +240,10 @@ func (c *DockerCommand) RefreshContainersAndServices() error {
|
||||||
func (c *DockerCommand) assignContainersToServices(containers []*Container, services []*Service) {
|
func (c *DockerCommand) assignContainersToServices(containers []*Container, services []*Service) {
|
||||||
for _, service := range services {
|
for _, service := range services {
|
||||||
for _, container := range containers {
|
for _, container := range containers {
|
||||||
if !container.OneOff && container.ServiceName == service.Name {
|
if /*!container.OneOff &&*/ container.ServiceName == service.Name {
|
||||||
service.Container = append(service.Container, container)
|
service.Container = append(service.Container, container)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if container.Container.Labels["com.docker.swarm.service.name"] == service.Name {
|
|
||||||
//Swarm service
|
|
||||||
service.Container = append(service.Container, container)
|
|
||||||
container.ServiceName = service.Name
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -330,7 +324,15 @@ func (c *DockerCommand) GetContainers() ([]*Container, error) {
|
||||||
newContainer.Name = strings.TrimLeft(container.Names[0], "/")
|
newContainer.Name = strings.TrimLeft(container.Names[0], "/")
|
||||||
}
|
}
|
||||||
newContainer.ServiceName = container.Labels["com.docker.compose.service"]
|
newContainer.ServiceName = container.Labels["com.docker.compose.service"]
|
||||||
|
if container.Labels["com.docker.swarm.service.name"] != "" {
|
||||||
|
newContainer.ServiceName = container.Labels["com.docker.swarm.service.name"]
|
||||||
|
}
|
||||||
|
|
||||||
newContainer.ProjectName = container.Labels["com.docker.compose.project"]
|
newContainer.ProjectName = container.Labels["com.docker.compose.project"]
|
||||||
|
if container.Labels["com.docker.stack.namespace"] != "" {
|
||||||
|
newContainer.ProjectName = container.Labels["com.docker.stack.namespace"]
|
||||||
|
}
|
||||||
|
|
||||||
newContainer.ContainerNumber = container.Labels["com.docker.compose.container"]
|
newContainer.ContainerNumber = container.Labels["com.docker.compose.container"]
|
||||||
newContainer.OneOff = container.Labels["com.docker.compose.oneoff"] == "True"
|
newContainer.OneOff = container.Labels["com.docker.compose.oneoff"] == "True"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue