diff --git a/pkg/compose/printer.go b/pkg/compose/printer.go index 2b2be4b37..158c98e54 100644 --- a/pkg/compose/printer.go +++ b/pkg/compose/printer.go @@ -93,11 +93,13 @@ func (p *printer) Run(ctx context.Context, cascadeStop bool, exitCodeFrom string return 0, err } } - if exitCodeFrom == "" { - exitCodeFrom = event.Service - } - if exitCodeFrom == event.Service { - exitCode = event.ExitCode + if event.Type == api.ContainerEventExit { + if exitCodeFrom == "" { + exitCodeFrom = event.Service + } + if exitCodeFrom == event.Service { + exitCode = event.ExitCode + } } } if len(containers) == 0 {