daemon: disallow container port 0

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
This commit is contained in:
Albin Kerouanton
2025-12-11 11:07:42 +01:00
parent c64b781df2
commit 43780fe40c
2 changed files with 13 additions and 1 deletions

View File

@@ -335,7 +335,7 @@ func validateHealthCheck(healthConfig *containertypes.HealthConfig) error {
func validatePortBindings(ports networktypes.PortMap) error {
for port := range ports {
if !port.IsValid() {
if !port.IsValid() || port.Num() == 0 {
return errors.Errorf("invalid port specification: %q", port.String())
}