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

Function resolveVolumeFrom

pkg/compose/convergence.go:73–91  ·  view source on GitHub ↗
(service *types.ServiceConfig, containersByService map[string]Containers)

Source from the content-addressed store, hash-verified

71}
72
73func resolveVolumeFrom(service *types.ServiceConfig, containersByService map[string]Containers) error {
74 for i, vol := range service.VolumesFrom {
75 spec := strings.Split(vol, ":")
76 if len(spec) == 0 {
77 continue
78 }
79 if spec[0] == "container" {
80 service.VolumesFrom[i] = spec[1]
81 continue
82 }
83 name := spec[0]
84 dependencies := containersByService[name]
85 if len(dependencies) == 0 {
86 return fmt.Errorf("cannot share volume with service %s: container missing", name)
87 }
88 service.VolumesFrom[i] = dependencies.sorted()[0].ID
89 }
90 return nil
91}
92
93func resolveSharedNamespaces(service *types.ServiceConfig, containersByService map[string]Containers) error {
94 if name := getDependentServiceFromMode(service.NetworkMode); name != "" {

Callers 1

resolveServiceReferencesFunction · 0.85

Calls 1

sortedMethod · 0.80

Tested by

no test coverage detected