Skip to content

ChangemakerStudios/Docker.Registry.DotNet

Repository files navigation

docker icon Docker.Registry.DotNet

NuGet version Build and Push to Nuget Downloads

.NET (C#) Client Library for interacting with a Docker Registry API (v2 only).

Setup

Install nuget package into your project via powershell:

PM> Install-Package Docker.Registry.DotNet

Add nuget package via dotnet CLI:

dotnet add package Docker.Registry.DotNet

Usage

Local Hub

var configuration = new RegistryClientConfiguration("http://localhost:5000");

//configuration.UsePasswordOAuthAuthentication("username", "password")

using (var client = configuration.CreateClient())
{
    // get catalog
    var catalog = await client.Catalog.GetCatalog();

    // list tags for the first catalog
    var tags = await client.Tags.ListTags(catalog?.Repositories.FirstOrDefault());
}

Remote Hub with Authentication

var configuration = new RegistryClientConfiguration("https://proget.mycompany.com");

configuration.UsePasswordOAuthAuthentication("username", "password");

using (var client = configuration.CreateClient())
{
    // get catalog
    var catalog = await client.Catalog.GetCatalog();

    // list tags for the first catalog
    var tags = await client.Tags.ListTags(catalog?.Repositories.FirstOrDefault());
}

Docker Hub

var configuration = new RegistryClientConfiguration("https://hub.docker.com");

using (var client = configuration.CreateClient())
{
    // load respository
    var tags = await client.Repository.ListRepositoryTags("grafana", "loki-docker-driver");
}