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

Method GetPublishedPortForPrivatePort

pkg/ddevapp/ddevapp.go:608–615  ·  view source on GitHub ↗

GetPublishedPortForPrivatePort returns the host-exposed public port of a container for a given private port.

(serviceName string, privatePort uint16)

Source from the content-addressed store, hash-verified

606
607// GetPublishedPortForPrivatePort returns the host-exposed public port of a container for a given private port.
608func (app *DdevApp) GetPublishedPortForPrivatePort(serviceName string, privatePort uint16) (publicPort int, err error) {
609 c, err := app.FindContainerByType(serviceName)
610 if err != nil || c == nil {
611 return -1, fmt.Errorf("failed to find container of type %s: %v", serviceName, err)
612 }
613 publishedPort := dockerutil.GetPublishedPort(privatePort, *c)
614 return publishedPort, nil
615}
616
617// GetOmittedContainers returns full list of global and local omitted containers
618func (app *DdevApp) GetOmittedContainers() []string {

Calls 3

FindContainerByTypeMethod · 0.95
GetPublishedPortFunction · 0.92
ErrorfMethod · 0.80