mirror of
https://github.com/docker/compose.git
synced 2025-07-23 05:34:36 +02:00
override inherited secret mounts
Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
parent
ebeef45e85
commit
30d6e1b9e2
@ -310,6 +310,16 @@ func buildContainerMountOptions(p types.Project, s types.ServiceConfig, inherit
|
|||||||
if definedSecret.External.External {
|
if definedSecret.External.External {
|
||||||
return nil, fmt.Errorf("unsupported external secret %s", definedSecret.Name)
|
return nil, fmt.Errorf("unsupported external secret %s", definedSecret.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if contains(inherited, target) {
|
||||||
|
// remove inherited mount
|
||||||
|
pos := indexOf(inherited, target)
|
||||||
|
if pos >= 0 {
|
||||||
|
mounts = append(mounts[:pos], mounts[pos+1])
|
||||||
|
inherited = append(inherited[:pos], inherited[pos+1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mount, err := buildMount(p, types.ServiceVolumeConfig{
|
mount, err := buildMount(p, types.ServiceVolumeConfig{
|
||||||
Type: types.VolumeTypeBind,
|
Type: types.VolumeTypeBind,
|
||||||
Source: definedSecret.File,
|
Source: definedSecret.File,
|
||||||
|
@ -38,3 +38,12 @@ func contains(slice []string, item string) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func indexOf(slice []string, item string) int {
|
||||||
|
for i, v := range slice {
|
||||||
|
if v == item {
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user