Exemple #1
0
        private Task ExecuteAsync(string image, IConsole console)
        {
            ImageName imageName = ImageName.Parse(image);

            return(CommandHelper.ExecuteCommandAsync(console, imageName.Registry, async() =>
            {
                using DockerRegistryClient.DockerRegistryClient client = await CommandHelper.GetRegistryClientAsync(imageName.Registry);

                ManifestInfo manifestInfo = await client.Manifests.GetAsync(imageName.Repo, (imageName.Tag ?? imageName.Digest) !);

                string output = JsonConvert.SerializeObject(manifestInfo.Manifest, Formatting.Indented);

                console.Out.WriteLine(output);
            }));
Exemple #2
0
        private Task ExecuteAsync(string?registry, IConsole console)
        {
            return(CommandHelper.ExecuteCommandAsync(console, registry, async() =>
            {
                using DockerRegistryClient.DockerRegistryClient client = await CommandHelper.GetRegistryClientAsync(registry);

                List <string> repoNames = new();

                Page <Catalog> catalogPage = await client.Catalog.GetAsync();
                repoNames.AddRange(catalogPage.Value.RepositoryNames);
                while (catalogPage.NextPageLink is not null)
                {
                    catalogPage = await client.Catalog.GetNextAsync(catalogPage.NextPageLink);
                    repoNames.AddRange(catalogPage.Value.RepositoryNames);
                }

                repoNames.Sort();

                string output = JsonConvert.SerializeObject(repoNames, Formatting.Indented);

                console.Out.WriteLine(output);
            }));
Exemple #3
0
        private Task ExecuteAsync(string repo, IConsole console)
        {
            ImageName imageName = ImageName.Parse(repo);

            return(CommandHelper.ExecuteCommandAsync(console, imageName.Registry, async() =>
            {
                using DockerRegistryClient.DockerRegistryClient client = await CommandHelper.GetRegistryClientAsync(imageName.Registry);

                List <string> tags = new();

                Page <RepositoryTags> tagsPage = await client.Tags.GetAsync(imageName.Repo);
                tags.AddRange(tagsPage.Value.Tags);
                while (tagsPage.NextPageLink is not null)
                {
                    tagsPage = await client.Tags.GetNextAsync(tagsPage.NextPageLink);
                    tags.AddRange(tagsPage.Value.Tags);
                }

                tags.Sort();

                string output = JsonConvert.SerializeObject(tags, Formatting.Indented);

                console.Out.WriteLine(output);
            }));