Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example using the transfer service #372

Merged
merged 1 commit into from
Feb 1, 2025
Merged

Conversation

estesp
Copy link
Member

@estesp estesp commented Jan 29, 2025

Pulls an image to the containerd content store

@github-actions github-actions bot added the C-client Containerd client label Jan 29, 2025
@estesp
Copy link
Member Author

estesp commented Jan 29, 2025

Sigh, what's the magic 😅

I ran rustup run nightly rustfmt --edition 2024 --emit stdout container_pull.rs and re-updated with slight changes to import ordering/formatting..still no love with CI checks on cargo fmt

@mxpv
Copy link
Member

mxpv commented Jan 31, 2025

You can run cargo fmt locally like this:

❯ cargo +nightly fmt --all -- --check
image

Pulls an image to the containerd content store

Signed-off-by: Phil Estes <[email protected]>
@estesp
Copy link
Member Author

estesp commented Jan 31, 2025

cargo +nightly fmt --all -- --check

Well, I tried that command and it didn't work with a strange error about lack of toolchain directive support in cargo, hence my weird invocation via rustup 😂 Turns out I had a weird path problem with my install, so now cargo +nightly works properly. Thanks!

@mxpv mxpv added this pull request to the merge queue Feb 1, 2025
Merged via the queue into containerd:main with commit 9d9cc05 Feb 1, 2025
18 checks passed
@aFuerst
Copy link

aFuerst commented Feb 6, 2025

@estesp can auth credentials to a private repository be passed with the OciRegistry.resolver headers hashmap?
I'm trying to replicate ctr images pull --user name:pass

Or a pointer to the containerd could would be helpful

@estesp estesp deleted the pull-example branch February 7, 2025 16:26
@estesp
Copy link
Member Author

estesp commented Feb 7, 2025

I haven't taken the time to implement it yet, but this feature depends on using a gRPC stream to handle a synchronous callback from containerd's transfer service to ask for credentials.

You pass the stream to the transfer service through the OCI registry type auth_stream entry in the RegistryResolver. Note that the general streaming API is defined here.

The transfer service sends an AuthRequest type on that stream and you would have to respond with an AuthResponse for that host. The headers entry is most likely just to support extra header content you wish to pass for that registry? More details on the auth flow in the transfer service doc: https://github.com/containerd/containerd/blob/main/docs/transfer.md#credentials

@aFuerst
Copy link

aFuerst commented Feb 7, 2025

Thanks for the pointers! I'll see if I can get it working, looks straightforward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-client Containerd client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants