Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 6a6dafb

Browse files
authored
Merge pull request #2026 from ulyssessouza/warn-pull-build
2 parents a5e8ab2 + 4364b48 commit 6a6dafb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pkg/compose/pull.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts
5858
w := progress.ContextWriter(ctx)
5959
eg, ctx := errgroup.WithContext(ctx)
6060

61+
var mustBuild []string
6162
for _, service := range project.Services {
6263
service := service
6364
if service.Image == "" {
@@ -72,6 +73,9 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts
7273
err := s.pullServiceImage(ctx, service, info, s.configFile, w, false)
7374
if err != nil {
7475
if !opts.IgnoreFailures {
76+
if service.Build != nil {
77+
mustBuild = append(mustBuild, service.Name)
78+
}
7579
return err
7680
}
7781
w.TailMsgf("Pulling %s: %s", service.Name, err.Error())
@@ -80,7 +84,13 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts
8084
})
8185
}
8286

83-
return eg.Wait()
87+
err = eg.Wait()
88+
89+
if !opts.IgnoreFailures && len(mustBuild) > 0 {
90+
w.TailMsgf("WARNING: Some service image(s) must be built from source by running:\n docker compose build %s", strings.Join(mustBuild, " "))
91+
}
92+
93+
return err
8494
}
8595

8696
func (s *composeService) pullServiceImage(ctx context.Context, service types.ServiceConfig, info moby.Info, configFile driver.Auth, w progress.Writer, quietPull bool) error {

0 commit comments

Comments
 (0)