{"id":"3010479d5ef2098a","repo":"docker/cli","slug":"no-public-port-s-published-for-s","errorCode":null,"errorMessage":"no public port '%s' published for %s","messagePattern":"no public port '(.+?)' published for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/port.go","lineNumber":69,"sourceCode":"//\n// TODO(thaJeztah): currently this defaults to show the TCP port if no\n// proto is specified. We should consider changing this to \"any\" protocol\n// for the given private port.\nfunc runPort(ctx context.Context, dockerCli command.Cli, opts *portOptions) error {\n\tc, err := dockerCli.Client().ContainerInspect(ctx, opts.container, client.ContainerInspectOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar out []string\n\tif opts.port != \"\" {\n\t\tport, err := network.ParsePort(opts.port)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfrontends, exists := c.Container.NetworkSettings.Ports[port]\n\t\tif !exists || len(frontends) == 0 {\n\t\t\treturn fmt.Errorf(\"no public port '%s' published for %s\", opts.port, opts.container)\n\t\t}\n\t\tfor _, frontend := range frontends {\n\t\t\tout = append(out, net.JoinHostPort(frontend.HostIP.String(), frontend.HostPort))\n\t\t}\n\t} else {\n\t\tfor from, frontends := range c.Container.NetworkSettings.Ports {\n\t\t\tfor _, frontend := range frontends {\n\t\t\t\tout = append(out, fmt.Sprintf(\"%s -> %s\", from, net.JoinHostPort(frontend.HostIP.String(), frontend.HostPort)))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(out) > 0 {\n\t\tsort.Slice(out, func(i, j int) bool {\n\t\t\treturn sortorder.NaturalLess(out[i], out[j])\n\t\t})\n\t\t_, _ = fmt.Fprintln(dockerCli.Out(), strings.Join(out, \"\\n\"))\n\t}","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/port.go#L51-L87","documentation":"Error \"no public port '%s' published for %s\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/container/port.go:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}