Skip to content

Commit

Permalink
fixed some containers being excluded on restart
Browse files Browse the repository at this point in the history
  • Loading branch information
yusing committed Sep 28, 2024
1 parent a78dba5 commit 91e7f48
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/docker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

"github.com/docker/docker/api/types"
"github.com/sirupsen/logrus"
U "github.com/yusing/go-proxy/internal/utils"
)

Expand All @@ -32,6 +33,9 @@ func FromDocker(c *types.Container, dockerHost string) (res Container) {
StopSignal: res.getDeleteLabel(LabelStopSignal),
Running: c.Status == "running" || c.State == "running",
}
if res.NetworkMode == "" {
logrus.Debugf("%v", res.NetworkSettings.Networks)
}
return
}

Expand All @@ -48,7 +52,7 @@ func FromJson(json types.ContainerJSON, dockerHost string) Container {
})
}
}
return FromDocker(&types.Container{
cont := FromDocker(&types.Container{
ID: json.ID,
Names: []string{json.Name},
Image: json.Image,
Expand All @@ -57,6 +61,8 @@ func FromJson(json types.ContainerJSON, dockerHost string) Container {
State: json.State.Status,
Status: json.State.Status,
}, dockerHost)
cont.NetworkMode = string(json.HostConfig.NetworkMode)
return cont
}

func (c Container) getDeleteLabel(label string) string {
Expand Down

0 comments on commit 91e7f48

Please sign in to comment.