@@ -306,7 +306,7 @@ func containerReasonEvents(containers Containers, eventFunc func(string, string)
306306const ServiceConditionRunningOrHealthy = "running_or_healthy"
307307
308308//nolint:gocyclo
309- func (s * composeService ) waitDependencies (ctx context.Context , project * types.Project , dependencies types.DependsOnConfig , containers Containers ) error {
309+ func (s * composeService ) waitDependencies (ctx context.Context , project * types.Project , service string , dependencies types.DependsOnConfig , containers Containers ) error {
310310 eg , _ := errgroup .WithContext (ctx )
311311 w := progress .ContextWriter (ctx )
312312 for dep , config := range dependencies {
@@ -318,6 +318,13 @@ func (s *composeService) waitDependencies(ctx context.Context, project *types.Pr
318318
319319 waitingFor := containers .filter (isService (dep ))
320320 w .Events (containerEvents (waitingFor , progress .Waiting ))
321+ if len (waitingFor ) == 0 {
322+ if config .Required {
323+ return fmt .Errorf ("%s is missing dependency %s" , service , dep )
324+ }
325+ logrus .Warnf ("%s is missing dependency %s" , service , dep )
326+ continue
327+ }
321328
322329 dep , config := dep , config
323330 eg .Go (func () error {
@@ -717,7 +724,7 @@ func (s *composeService) startService(ctx context.Context, project *types.Projec
717724 return nil
718725 }
719726
720- err := s .waitDependencies (ctx , project , service .DependsOn , containers )
727+ err := s .waitDependencies (ctx , project , service .Name , service . DependsOn , containers )
721728 if err != nil {
722729 return err
723730 }
0 commit comments