diff --git a/core/remotes/docker/fetcher.go b/core/remotes/docker/fetcher.go index 90542e2e75cb..59c0e3dd8ce9 100644 --- a/core/remotes/docker/fetcher.go +++ b/core/remotes/docker/fetcher.go @@ -459,7 +459,7 @@ func (r dockerFetcher) open(ctx context.Context, req *request, mediatype string, if err := r.Acquire(ctx, 1); err != nil { return nil, err } - resp, err := req.doWithRetries(ctx, lastHost, withErrorCheck, withOffsetCheck(offset)) + resp, err := req.doWithRetries(ctx, lastHost, withErrorCheck, withOffsetCheck(offset, parallelism)) switch err { case nil: // all good diff --git a/core/remotes/docker/fetcher_test.go b/core/remotes/docker/fetcher_test.go index c88067b101eb..bfb06ff415ec 100644 --- a/core/remotes/docker/fetcher_test.go +++ b/core/remotes/docker/fetcher_test.go @@ -247,6 +247,7 @@ func TestFetcherOpenParallel(t *testing.T) { sendContentLength = true ignoreContentRange = true + checkReader(0) checkReader(25) ignoreContentRange = false diff --git a/core/remotes/docker/resolver.go b/core/remotes/docker/resolver.go index 1c0f7c48421d..05bebd36c8eb 100644 --- a/core/remotes/docker/resolver.go +++ b/core/remotes/docker/resolver.go @@ -659,9 +659,9 @@ func withErrorCheck(r *request, resp *http.Response) error { var errContentRangeIgnored = errors.New("content range requests ignored") -func withOffsetCheck(offset int64) doChecks { +func withOffsetCheck(offset, parallelism int64) doChecks { return func(r *request, resp *http.Response) error { - if offset == 0 { + if parallelism <= 1 && offset == 0 { return nil } if resp.StatusCode == http.StatusPartialContent {