mirror of
https://github.com/docker/compose.git
synced 2025-07-23 13:45:00 +02:00
prefix volumes with container:
as we resolve service into container
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
e8666b02f3
commit
f3171e90cf
@ -353,6 +353,14 @@ func (s *composeService) getCreateOptions(ctx context.Context, p *types.Project,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var volumesFrom []string
|
||||||
|
for _, v := range service.VolumesFrom {
|
||||||
|
if !strings.HasPrefix(v, "container:") {
|
||||||
|
return nil, nil, nil, fmt.Errorf("invalid volume_from: %s", v)
|
||||||
|
}
|
||||||
|
volumesFrom = append(volumesFrom, v[len("container:"):])
|
||||||
|
}
|
||||||
|
|
||||||
hostConfig := container.HostConfig{
|
hostConfig := container.HostConfig{
|
||||||
AutoRemove: autoRemove,
|
AutoRemove: autoRemove,
|
||||||
Binds: binds,
|
Binds: binds,
|
||||||
@ -369,7 +377,7 @@ func (s *composeService) getCreateOptions(ctx context.Context, p *types.Project,
|
|||||||
PortBindings: portBindings,
|
PortBindings: portBindings,
|
||||||
Resources: resources,
|
Resources: resources,
|
||||||
VolumeDriver: service.VolumeDriver,
|
VolumeDriver: service.VolumeDriver,
|
||||||
VolumesFrom: service.VolumesFrom,
|
VolumesFrom: volumesFrom,
|
||||||
DNS: service.DNS,
|
DNS: service.DNS,
|
||||||
DNSSearch: service.DNSSearch,
|
DNSSearch: service.DNSSearch,
|
||||||
DNSOptions: service.DNSOpts,
|
DNSOptions: service.DNSOpts,
|
||||||
@ -612,7 +620,10 @@ func getVolumesFrom(project *types.Project, volumesFrom []string) ([]string, []s
|
|||||||
}
|
}
|
||||||
|
|
||||||
firstContainer := getContainerName(project.Name, service, 1)
|
firstContainer := getContainerName(project.Name, service, 1)
|
||||||
v := fmt.Sprintf("%s:%s", firstContainer, strings.Join(spec[1:], ":"))
|
v := fmt.Sprintf("container:%s", firstContainer)
|
||||||
|
if len(spec) > 2 {
|
||||||
|
v = fmt.Sprintf("container:%s:%s", firstContainer, strings.Join(spec[1:], ":"))
|
||||||
|
}
|
||||||
volumes = append(volumes, v)
|
volumes = append(volumes, v)
|
||||||
}
|
}
|
||||||
return volumes, services, nil
|
return volumes, services, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user