diff --git a/pkg/compose/watch.go b/pkg/compose/watch.go index 2daefdd3d..5de5bc12a 100644 --- a/pkg/compose/watch.go +++ b/pkg/compose/watch.go @@ -143,6 +143,10 @@ func (s *composeService) Watch(ctx context.Context, project *types.Project, serv var paths []string 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) } @@ -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 +}