| Crates.io | hub-tool |
| lib.rs | hub-tool |
| version | 0.0.4 |
| created_at | 2025-03-05 14:19:53.348441+00 |
| updated_at | 2025-03-06 19:15:12.261514+00 |
| description | A (very early) asynchronous Rust library for the Docker Hub API v2 |
| homepage | |
| repository | https://github.com/alvarobartt/hub-tool-rs |
| max_upload_size | |
| id | 1579067 |
| size | 73,455 |
A (very early) asynchronous Rust library for the Docker Hub API v2
[!WARNING] At the moment only listing the repositories and the tags for a given org or username is supported, the SDK may be unstable and subject to breaking changes.
Get started with cargo add hub-tool and a Docker Hub account, to generate a Personal
Access Token (PAT) from https://app.docker.com/settings/personal-access-tokens, to
send request to the Docker Hub API from hub-tool.
hub-tool to be more than a Docker Hub
API wrapper, and add functionality on top e.g. filtering.use anyhow::Context;
use hub_tool::DockerHubClient;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = DockerHubClient::new("dckr_pat_***")
.context("couldn't initialize the docker client")?;
// Fetch the repositories under a given org or username on the Docker Hub
let repositories = client.list_repositories("ollama")
.await
.context("failed while fetching the repositories")?;
// Fetch the tags for a given repository on the Docker Hub
let tags = client.list_tags("ollama", "quantize")
.await
.context("failed while fetching the tags")?;
Ok(())
}
This project is licensed under either of the following licenses, at your option:
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.