mirror of
https://github.com/docker/compose.git
synced 2025-04-08 17:05:13 +02:00
watch: add warning when a path is already used by a bind mount volume (#10741)
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
parent
db24023884
commit
035276e027
@ -143,6 +143,10 @@ func (s *composeService) Watch(ctx context.Context, project *types.Project, serv
|
|||||||
|
|
||||||
var paths []string
|
var paths []string
|
||||||
for _, trigger := range config.Watch {
|
for _, trigger := range config.Watch {
|
||||||
|
if checkIfPathAlreadyBindMounted(trigger.Path, service.Volumes) {
|
||||||
|
logrus.Warnf("path '%s' also declared by a bind mount volume, this path won't be monitored!\n", trigger.Path)
|
||||||
|
continue
|
||||||
|
}
|
||||||
paths = append(paths, trigger.Path)
|
paths = append(paths, trigger.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,3 +387,12 @@ func debounce(ctx context.Context, clock clockwork.Clock, delay time.Duration, i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkIfPathAlreadyBindMounted(watchPath string, volumes []types.ServiceVolumeConfig) bool {
|
||||||
|
for _, volume := range volumes {
|
||||||
|
if volume.Bind != nil && strings.HasPrefix(watchPath, volume.Source) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user