Expand description
§dimicon - Docker Image Icon
A Rust library for fetching Docker image icons from various sources.
§Features
- Fetch icons from Docker Hub image logos
- Fetch icons from Docker Hub organization Gravatars
- Fetch icons from Docker Official Images (via jsDelivr CDN)
- Fetch icons from GitHub Container Registry (via GitHub Avatar)
- Parse Docker image reference strings
§Quick Start
use dimicon::IconService;
#[tokio::main]
async fn main() -> Result<(), dimicon::Error> {
let service = IconService::new();
// Get icon for an official image
let icon = service.get_icon("nginx").await?;
println!("nginx icon: {:?}", icon.url());
// Get icon for a user image
let icon = service.get_icon("localstack/localstack").await?;
println!("localstack icon: {:?}", icon.url());
// Get icon for a ghcr.io image
let icon = service.get_icon("ghcr.io/corespeed-io/myapp").await?;
println!("ghcr icon: {:?}", icon.url());
Ok(())
}§Image Reference Parsing
The library can parse various Docker image reference formats:
use dimicon::ImageReference;
// Simple image name
let img = ImageReference::parse("nginx").unwrap();
assert!(img.is_docker_official());
// Image with tag
let img = ImageReference::parse("nginx:latest").unwrap();
assert_eq!(img.tag, Some("latest".to_string()));
// User/org image
let img = ImageReference::parse("myuser/myimage:v1.0").unwrap();
assert_eq!(img.namespace, "myuser");
// GHCR image
let img = ImageReference::parse("ghcr.io/owner/app:latest").unwrap();
assert!(img.is_ghcr());§Supported Registries
| Registry | Icon Source |
|---|---|
| Docker Hub (docker.io) | Image logo, Org Gravatar, Official Image logo |
| GitHub Container Registry (ghcr.io) | GitHub Avatar |
| Other registries | Not supported (returns NotFound) |
Structs§
- Docker
HubLogo Response - Docker Hub image logo API response
- Docker
HubOrg Response - Docker Hub organization info response
- Docker
HubUser Response - Docker Hub user info response
- Icon
Service - Mirror icon service
- Image
Reference - Parsed mirror reference
Enums§
- Error
- dimicon library error types
- Icon
Source - Image icon source - Identify the source of the icon
Functions§
- get_
icon - Convenience function to get an icon for an image