MCPcopy Create free account
hub / github.com/docker/compose / Ports

Method Ports

cmd/formatter/container.go:216–233  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

214}
215
216func (c *ContainerContext) Ports() string {
217 var ports []container.PortSummary
218 for _, publisher := range c.c.Publishers {
219 var pIP netip.Addr
220 if publisher.URL != "" {
221 if p, err := netip.ParseAddr(publisher.URL); err == nil {
222 pIP = p
223 }
224 }
225 ports = append(ports, container.PortSummary{
226 IP: pIP,
227 PrivatePort: uint16(publisher.TargetPort),
228 PublicPort: uint16(publisher.PublishedPort),
229 Type: publisher.Protocol,
230 })
231 }
232 return formatter.DisplayablePorts(ports)
233}
234
235// Labels returns a comma-separated string of labels present on the container.
236func (c *ContainerContext) Labels() string {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected