Fix empty ip when container is stopped
This commit is contained in:
parent
b572879691
commit
47a5cfbd3e
3 changed files with 71 additions and 2 deletions
|
@ -835,8 +835,12 @@ func listContainers(ctx context.Context, dockerClient client.ContainerAPIClient)
|
|||
if err != nil {
|
||||
log.Warnf("Failed to inspect container %s, error: %s", container.ID, err)
|
||||
} else {
|
||||
dockerData := parseContainer(containerInspected)
|
||||
containersInspected = append(containersInspected, dockerData)
|
||||
// This condition is here to avoid to have empty IP https://github.com/containous/traefik/issues/2459
|
||||
// We register only container which are running
|
||||
if containerInspected.ContainerJSONBase != nil && containerInspected.ContainerJSONBase.State != nil && containerInspected.ContainerJSONBase.State.Running {
|
||||
dockerData := parseContainer(containerInspected)
|
||||
containersInspected = append(containersInspected, dockerData)
|
||||
}
|
||||
}
|
||||
}
|
||||
return containersInspected, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue