fix: allow to expose a port multiple times in Docker

This change prevents user-specified exposed ports from overriding the
default ones.

This allows one e.g. to export the Kubernetes endpoint both at the
default random port and at a specified host address.

Signed-off-by: Dmitrii Sharshakov <dmitry.sharshakov@siderolabs.com>
This commit is contained in:
Dmitrii Sharshakov 2026-01-24 10:58:20 +01:00
parent 410d8cb572
commit e48c6d7ab9
No known key found for this signature in database
GPG Key ID: 9866BBFAF691F3AF

View File

@ -320,12 +320,10 @@ func genPortMap(portList []string, defaultHostIP string) (portMap, error) {
}
portSetRet[natPort] = struct{}{}
portMapRet[natPort] = []network.PortBinding{
{
HostIP: hostAddr,
HostPort: hostPort,
},
}
portMapRet[natPort] = append(portMapRet[natPort], network.PortBinding{
HostIP: hostAddr,
HostPort: hostPort,
})
}
return portMap{portSetRet, portMapRet}, nil