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

Method createContainer

pkg/compose/convergence.go:306–324  ·  pkg/compose/convergence.go::composeService.createContainer
(ctx context.Context, project *types.Project, service types.ServiceConfig,
	name string, number int, opts createOptions,
)

Source from the content-addressed store, hash-verified

304}
305
306func (s *composeService) createContainer(ctx context.Context, project *types.Project, service types.ServiceConfig,
307 name string, number int, opts createOptions,
308) (ctr container.Summary, err error) {
309 eventName := "Container " + name
310 s.events.On(creatingEvent(eventName))
311 ctr, err = s.createMobyContainer(ctx, project, service, name, number, nil, opts)
312 if err != nil {
313 if ctx.Err() == nil {
314 s.events.On(api.Resource{
315 ID: eventName,
316 Status: api.Error,
317 Text: err.Error(),
318 })
319 }
320 return ctr, err
321 }
322 s.events.On(createdEvent(eventName))
323 return ctr, nil
324}
325
326// force sequential calls to ContainerStart to prevent race condition in engine assigning ports from ranges
327var startMx sync.Mutex

Callers 1

prepareRunMethod · 0.95

Calls 6

createMobyContainerMethod · 0.95
creatingEventFunction · 0.85
createdEventFunction · 0.85
ErrorMethod · 0.80
OnMethod · 0.65
ErrMethod · 0.65

Tested by

no test coverage detected