mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-21 23:01:03 +00:00
show ports at top of container config
This commit is contained in:
parent
05f931e207
commit
8242bd279a
2 changed files with 16 additions and 2 deletions
|
|
@ -193,7 +193,9 @@ type Details struct {
|
|||
HairpinMode bool `json:"HairpinMode"`
|
||||
LinkLocalIPv6Address string `json:"LinkLocalIPv6Address"`
|
||||
LinkLocalIPv6PrefixLen int `json:"LinkLocalIPv6PrefixLen"`
|
||||
Ports struct {
|
||||
Ports map[string][]struct {
|
||||
HostIP string `json:"HostIP"`
|
||||
HostPort string `json:"HostPort"`
|
||||
} `json:"Ports"`
|
||||
SandboxKey string `json:"SandboxKey"`
|
||||
SecondaryIPAddresses interface{} `json:"SecondaryIPAddresses"`
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ func (gui *Gui) renderContainerConfig(container *commands.Container) error {
|
|||
mainView.Autoscroll = false
|
||||
mainView.Wrap = true
|
||||
|
||||
padding := 15
|
||||
padding := 10
|
||||
output := ""
|
||||
output += utils.WithPadding("ID: ", padding) + container.ID + "\n"
|
||||
output += utils.WithPadding("Name: ", padding) + container.Name + "\n"
|
||||
|
|
@ -136,6 +136,18 @@ func (gui *Gui) renderContainerConfig(container *commands.Container) error {
|
|||
output += "none\n"
|
||||
}
|
||||
|
||||
output += utils.WithPadding("Ports: ", padding)
|
||||
if len(container.Details.NetworkSettings.Ports) > 0 {
|
||||
output += "\n"
|
||||
for k, v := range container.Details.NetworkSettings.Ports {
|
||||
for _, host := range v {
|
||||
output += fmt.Sprintf("%s%s %s\n", strings.Repeat(" ", padding), utils.ColoredString(host.HostPort+":", color.FgYellow), k)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
output += "none\n"
|
||||
}
|
||||
|
||||
data, err := json.MarshalIndent(&container.Details, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue