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

Method getContainerSummary

pkg/compose/monitor.go:190–206  ·  view source on GitHub ↗
(event events.Message)

Source from the content-addressed store, hash-verified

188}
189
190func (c *monitor) getContainerSummary(event events.Message) (*api.ContainerSummary, error) {
191 ctr := &api.ContainerSummary{
192 ID: event.Actor.ID,
193 Name: event.Actor.Attributes["name"],
194 Project: c.project,
195 Service: event.Actor.Attributes[api.ServiceLabel],
196 Labels: event.Actor.Attributes, // More than just labels, but that'c the closest the API gives us
197 }
198 if ec, ok := event.Actor.Attributes["exitCode"]; ok {
199 exitCode, err := strconv.Atoi(ec)
200 if err != nil {
201 return nil, err
202 }
203 ctr.ExitCode = exitCode
204 }
205 return ctr, nil
206}
207
208func (c *monitor) withListener(listener api.ContainerEventListener) {
209 c.listeners = append(c.listeners, listener)

Callers 1

StartMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected