MCPcopy
hub / github.com/docker/compose / NewContainerContext

Function NewContainerContext

cmd/formatter/container.go:113–131  ·  view source on GitHub ↗

NewContainerContext creates a new context for rendering containers

()

Source from the content-addressed store, hash-verified

111
112// NewContainerContext creates a new context for rendering containers
113func NewContainerContext() *ContainerContext {
114 containerCtx := ContainerContext{}
115 containerCtx.Header = formatter.SubHeaderContext{
116 "ID": formatter.ContainerIDHeader,
117 "Name": nameHeader,
118 "Project": projectHeader,
119 "Service": serviceHeader,
120 "Image": formatter.ImageHeader,
121 "Command": commandHeader,
122 "CreatedAt": formatter.CreatedAtHeader,
123 "RunningFor": runningForHeader,
124 "Ports": formatter.PortsHeader,
125 "State": formatter.StateHeader,
126 "Status": formatter.StatusHeader,
127 "Size": formatter.SizeHeader,
128 "Labels": formatter.LabelsHeader,
129 }
130 return &containerCtx
131}
132
133// MarshalJSON makes ContainerContext implement json.Marshaler
134func (c *ContainerContext) MarshalJSON() ([]byte, error) {

Callers 1

ContainerWriteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected