mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Add ExposedPorts to Inspect's ContainerConfig
A field we missed versus Docker. Matches the format of our existing Ports list in the NetworkConfig, but only includes exposed ports (and maps these to struct{}, as they never go to real ports on the host). Fixes https://issues.redhat.com/browse/RHEL-60382 Signed-off-by: Matt Heon <mheon@redhat.com>
This commit is contained in:
@ -4,6 +4,7 @@ package libpod
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/image/v5/docker"
|
||||
"github.com/containers/image/v5/pkg/shortnames"
|
||||
@ -175,6 +176,13 @@ func (c *Container) validate() error {
|
||||
return fmt.Errorf("cannot set a startup healthcheck when there is no regular healthcheck: %w", define.ErrInvalidArg)
|
||||
}
|
||||
|
||||
// Ensure all ports list a single protocol
|
||||
for _, p := range c.config.PortMappings {
|
||||
if strings.Contains(p.Protocol, ",") {
|
||||
return fmt.Errorf("each port mapping must define a single protocol, got a comma-separated list for container port %d (protocols requested %q): %w", p.ContainerPort, p.Protocol, define.ErrInvalidArg)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user