You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
Hi, I am working on a project which needs me to copy one repository to another. My UploadLayer calls are failing. I keep getting this fault http: ContentLength=32 with Body length 0
neither UploadBlob() (former UploadLayer()), nor PutManifest() is working properly in case of token authentication (see details). More precisely they cannot resend the body of the request after the 401 Unauthorized response, because the content reader is not reusable.
Another way to reproduce the issue:
username, password := "<your DockerHub username>", "<your DockerHub password>"
repository := username + "/docker-registry-client-test"
registry, err := New("https://registry-1.docker.io", username, password)
if err != nil {
log.Fatal("couldn't connect to registry:", err)
}
blobData := []byte("This is a test blob.")
digest := digest.FromBytes(blobData)
content := bytes.NewBuffer(blobData)
err = registry.UploadBlob(repository, digest, content)
if err != nil {
log.Fatal("couldn't upload blob:", err)
}
This will result in the same error: http: ContentLength=20 with Body length 0.
If a file is given instead of buffer, the error becomes: file already closed
The problem is that in TokenTransport.retry() the HTTP PUT request is resent with the same Body, but by that time all (or at least some) bytes were already read from the corresponding Reader.
@codervinod, could you rename the issue to reflect that UploadBlob() and all other HTTP requests with a non-empty body, are broken in case of token authentication?
Hi, I am working on a project which needs me to copy one repository to another. My UploadLayer calls are failing. I keep getting this fault http: ContentLength=32 with Body length 0
Could you please help?
Thanks,
Vinod
exists, err := hub.HasLayer("abc/hello-abc-test1", digest)
The text was updated successfully, but these errors were encountered: