remove unmapped ports from inspect port bindings

Signed-off-by: Jakob Ahrer <jakob@ahrer.dev>
This commit is contained in:
Jakob Ahrer
2022-12-13 17:46:52 +01:00
committed by SoMuchForSubtlety
parent 0037bffbb1
commit 97f63da67d
6 changed files with 49 additions and 5 deletions

View File

@ -312,7 +312,12 @@ func writeHijackHeader(r *http.Request, conn io.Writer) {
}
// Convert OCICNI port bindings into Inspect-formatted port bindings.
func makeInspectPortBindings(bindings []types.PortMapping, expose map[uint16][]string) map[string][]define.InspectHostPort {
func makeInspectPortBindings(bindings []types.PortMapping) map[string][]define.InspectHostPort {
return makeInspectPorts(bindings, nil)
}
// Convert OCICNI port bindings into Inspect-formatted port bindings with exposed, but not bound ports set to nil.
func makeInspectPorts(bindings []types.PortMapping, expose map[uint16][]string) map[string][]define.InspectHostPort {
portBindings := make(map[string][]define.InspectHostPort)
for _, port := range bindings {
protocols := strings.Split(port.Protocol, ",")