oras-project / rust-oci-client

A Rust crate to interact with OCI registries
Apache License 2.0
90 stars 47 forks source link

Pull/Push image from docker registry #78

Closed lswith closed 1 year ago

lswith commented 1 year ago

I am trying to pull an image from the docker registry (alpine:latest) and then push it to a new location (lswith/alpine:latest) but it is failing with:

ServerError { code: 400, url: "https://registry-1.docker.io/v2/lswith/alpine/blobs/uploads/e488224e-f12e-4847-8064-295821978d87?_state=tNqxkQDw_X5kfWHybi_XdEgAxTTOBu_K03ZSja9Hjqx7Ik5hbWUiOiJsc3dpdGgvYWxwaW5lIiwiVVVJRCI6ImU0ODgyMjRlLWYxMmUtNDg0Ny04MDY0LTI5NTgyMTk3OGQ4NyIsIk9mZnNldCI6NjExLCJTdGFydGVkQXQiOiIyMDIzLTA0LTIyVDA1OjI1OjMyWiJ9&digest=sha256%3A9ed4aefc74f6792b5a804d1d146fe4b4a2299147b0f50eaf2b08435d7b38c27e", message: "{\"errors\":[{\"code\":\"DIGEST_INVALID\",\"message\":\"provided digest did not match uploaded content\",\"detail\":\"invalid digest for referenced layer: sha256:9ed4aefc74f6792b5a804d1d146fe4b4a2299147b0f50eaf2b08435d7b38c27e, content does not match digest\"}]}\n" }'

I'm not sure if this is a bug in this library or a bug in my understanding of how to push and pull images. Sample code is at https://github.com/lswith/registry-tester

lswith commented 1 year ago

This was a misunderstanding on my part. The Digest had changed because the Config was parsed into a ConfigFile.