mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 10:18:59 +02:00
feat(docker): add network field to container info
This commit is contained in:
@@ -35,6 +35,7 @@ type (
|
|||||||
|
|
||||||
Mounts []string `json:"mounts"`
|
Mounts []string `json:"mounts"`
|
||||||
|
|
||||||
|
Network string `json:"network,omitempty"`
|
||||||
PublicPortMapping PortMapping `json:"public_ports"` // non-zero publicPort:types.Port
|
PublicPortMapping PortMapping `json:"public_ports"` // non-zero publicPort:types.Port
|
||||||
PrivatePortMapping PortMapping `json:"private_ports"` // privatePort:types.Port
|
PrivatePortMapping PortMapping `json:"private_ports"` // privatePort:types.Port
|
||||||
PublicHostname string `json:"public_hostname"`
|
PublicHostname string `json:"public_hostname"`
|
||||||
@@ -216,8 +217,9 @@ func (c *Container) setPrivateHostname(helper containerHelper) {
|
|||||||
if helper.NetworkSettings == nil {
|
if helper.NetworkSettings == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, v := range helper.NetworkSettings.Networks {
|
for k, v := range helper.NetworkSettings.Networks {
|
||||||
if v.IPAddress != "" {
|
if v.IPAddress != "" {
|
||||||
|
c.Network = k // update network to the first network
|
||||||
c.PrivateHostname = v.IPAddress
|
c.PrivateHostname = v.IPAddress
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user