MCPcopy Create free account
hub / github.com/docker/cli / LoadService

Function LoadService

cli/compose/loader/loader.go:411–429  ·  view source on GitHub ↗

LoadService produces a single ServiceConfig from a compose file Dict the serviceDict is not validated if directly used. Use Load() to enable validation

(name string, serviceDict map[string]any, workingDir string, lookupEnv template.Mapping)

Source from the content-addressed store, hash-verified

409// LoadService produces a single ServiceConfig from a compose file Dict
410// the serviceDict is not validated if directly used. Use Load() to enable validation
411func LoadService(name string, serviceDict map[string]any, workingDir string, lookupEnv template.Mapping) (*types.ServiceConfig, error) {
412 serviceConfig := &types.ServiceConfig{}
413 if err := Transform(serviceDict, serviceConfig); err != nil {
414 return nil, err
415 }
416 serviceConfig.Name = name
417
418 if err := resolveEnvironment(serviceConfig, workingDir, lookupEnv); err != nil {
419 return nil, err
420 }
421
422 if err := resolveVolumePaths(serviceConfig.Volumes, workingDir, lookupEnv); err != nil {
423 return nil, err
424 }
425
426 serviceConfig.Extras = getExtras(serviceDict)
427
428 return serviceConfig, nil
429}
430
431func loadExtras(name string, source map[string]any) map[string]any {
432 if dict, ok := source[name].(map[string]any); ok {

Callers 1

LoadServicesFunction · 0.85

Calls 4

TransformFunction · 0.85
resolveEnvironmentFunction · 0.85
resolveVolumePathsFunction · 0.85
getExtrasFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…