MCPcopy Create free account
hub / github.com/ddev/ddev / GetPublishedPort

Function GetPublishedPort

pkg/dockerutil/containers.go:563–570  ·  view source on GitHub ↗

GetPublishedPort returns the published port for a given private port.

(privatePort uint16, c container.Summary)

Source from the content-addressed store, hash-verified

561
562// GetPublishedPort returns the published port for a given private port.
563func GetPublishedPort(privatePort uint16, c container.Summary) int {
564 for _, port := range c.Ports {
565 if port.PrivatePort == privatePort {
566 return int(port.PublicPort)
567 }
568 }
569 return 0
570}
571
572// RunSimpleContainer runs a container (non-daemonized) and captures the stdout/stderr.
573// It will block, so not to be run on a container whose entrypoint or cmd might hang or run too long.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected