pull: only skip pull when policy is `missing`/`if_not_present`

Fixes #9773.

Signed-off-by: Nick Sieger <nick@nicksieger.com>
This commit is contained in:
Nick Sieger 2022-08-22 08:41:08 -05:00
parent 6eb34031f6
commit 5723dee316
No known key found for this signature in database
GPG Key ID: 222EA328BD6E402A
3 changed files with 8 additions and 9 deletions

View File

@ -96,15 +96,6 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts
})
continue
}
default:
if _, ok := images[service.Image]; ok {
w.Event(progress.Event{
ID: service.Name,
Status: progress.Done,
Text: "Skipped - Image is already present locally",
})
continue
}
}
if s, ok := imagesBeingPulled[service.Image]; ok {

View File

@ -131,6 +131,13 @@ func TestComposePull(t *testing.T) {
assert.Assert(t, strings.Contains(output, "simple Pulled"))
assert.Assert(t, strings.Contains(output, "another Pulled"))
// verify default policy is 'always' for pull command
res = c.RunDockerComposeCmd(t, "--project-directory", "fixtures/compose-pull/simple", "pull")
output = res.Combined()
assert.Assert(t, strings.Contains(output, "simple Pulled"))
assert.Assert(t, strings.Contains(output, "another Pulled"))
})
t.Run("Verify a image is pulled once", func(t *testing.T) {

View File

@ -1,4 +1,5 @@
services:
simple:
image: alpine:3.13.12
pull_policy: missing
command: top