mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-09 04:52:35 +02:00
fixed some containers being excluded on restart
This commit is contained in:
parent
a78dba5191
commit
91e7f4894a
1 changed files with 7 additions and 1 deletions
|
@ -6,6 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
U "github.com/yusing/go-proxy/internal/utils"
|
U "github.com/yusing/go-proxy/internal/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,6 +33,9 @@ func FromDocker(c *types.Container, dockerHost string) (res Container) {
|
||||||
StopSignal: res.getDeleteLabel(LabelStopSignal),
|
StopSignal: res.getDeleteLabel(LabelStopSignal),
|
||||||
Running: c.Status == "running" || c.State == "running",
|
Running: c.Status == "running" || c.State == "running",
|
||||||
}
|
}
|
||||||
|
if res.NetworkMode == "" {
|
||||||
|
logrus.Debugf("%v", res.NetworkSettings.Networks)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +52,7 @@ func FromJson(json types.ContainerJSON, dockerHost string) Container {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FromDocker(&types.Container{
|
cont := FromDocker(&types.Container{
|
||||||
ID: json.ID,
|
ID: json.ID,
|
||||||
Names: []string{json.Name},
|
Names: []string{json.Name},
|
||||||
Image: json.Image,
|
Image: json.Image,
|
||||||
|
@ -57,6 +61,8 @@ func FromJson(json types.ContainerJSON, dockerHost string) Container {
|
||||||
State: json.State.Status,
|
State: json.State.Status,
|
||||||
Status: json.State.Status,
|
Status: json.State.Status,
|
||||||
}, dockerHost)
|
}, dockerHost)
|
||||||
|
cont.NetworkMode = string(json.HostConfig.NetworkMode)
|
||||||
|
return cont
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Container) getDeleteLabel(label string) string {
|
func (c Container) getDeleteLabel(label string) string {
|
||||||
|
|
Loading…
Add table
Reference in a new issue