mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-15 14:36:48 +02:00
feat(docker): add network field to container info
This commit is contained in:
parent
4abf61a421
commit
5fdb023188
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue