mirror of
https://github.com/docker/compose.git
synced 2025-07-13 16:54:25 +02:00
pull
to respect pull_policy
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
03aadcc85a
commit
625a48dcf7
@ -55,6 +55,11 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts
|
|||||||
info.IndexServerAddress = registry.IndexServer
|
info.IndexServerAddress = registry.IndexServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
images, err := s.getLocalImagesDigests(ctx, project)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
w := progress.ContextWriter(ctx)
|
w := progress.ContextWriter(ctx)
|
||||||
eg, ctx := errgroup.WithContext(ctx)
|
eg, ctx := errgroup.WithContext(ctx)
|
||||||
|
|
||||||
@ -69,6 +74,26 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts
|
|||||||
})
|
})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch service.PullPolicy {
|
||||||
|
case types.PullPolicyNever, types.PullPolicyBuild:
|
||||||
|
w.Event(progress.Event{
|
||||||
|
ID: service.Name,
|
||||||
|
Status: progress.Done,
|
||||||
|
Text: "Skipped",
|
||||||
|
})
|
||||||
|
continue
|
||||||
|
case types.PullPolicyMissing, types.PullPolicyIfNotPresent:
|
||||||
|
if _, ok := images[service.Image]; ok {
|
||||||
|
w.Event(progress.Event{
|
||||||
|
ID: service.Name,
|
||||||
|
Status: progress.Done,
|
||||||
|
Text: "Exists",
|
||||||
|
})
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
err := s.pullServiceImage(ctx, service, info, s.configFile(), w, false)
|
err := s.pullServiceImage(ctx, service, info, s.configFile(), w, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user