How could I list the images pushed to microk8s built-in registry
Asked Answered
A

5

14

I installed microk8s and I enabled registry addon I am able to push docker images to this registry and I am able to use this images in deployments.

But I'm trying to list images that was already pushed to this registry. How can I do that? Is there an API for that?

Alesandrini answered 19/5, 2020 at 3:29 Comment(0)
A
14

I found that it's possible to list the registry images via HTTP GET in this address: http://<host_ip>:32000/v2/_catalog

It'll return the images in a json response

Alesandrini answered 20/5, 2020 at 22:6 Comment(0)
D
12

Use command microk8s ctr images list. To know more use --help

microk8s ctr images --help
NAME:
   ctr images - manage images

USAGE:
   ctr images command [command options] [arguments...]

COMMANDS:
     check       check that an image has all content available locally
     export      export an image
     import      import images
     list, ls    list images known to containerd
     pull        pull an image from a remote
     push        push an image to a remote
     remove, rm  remove one or more images by reference
     label       set and clear labels for an image

OPTIONS:
   --help, -h  show help
Disagreement answered 19/5, 2020 at 5:15 Comment(5)
I get the following response when I run this command: "Cannot use two forms of the same flag: n namespace"Alesandrini
That returned a lot of information, but I cannot identify the images that were displayed. It returned their sha256 digest wich is not usefulAlesandrini
I am looking for the image's name and its tagsAlesandrini
I am getting only the cached images with this command. I know for a fact that there are other images on the registry that I cannot see here. Only after Kubernetes starts a pod with on of the images in the registry, that image appears in the list with this command.Broccoli
Please keep in mind that the Docker REGISTRY and the images hosted in CONTAINERD are distinct things.Francie
S
6

Following REST APIs will do the job:

  1. Listing repositories:

http://host:32000/v2/_catalog?n=10

Last parameter n is the size of records to be returned. One can skip passing it but if you expect a long list then it's better to use pagination.

  1. Listing the images in the repository

http://host:32000/v2/repositoryName/tags/list?n=10

Note: Replace host and repositoryName accordingly.

For complete reference visit: https://docs.docker.com/registry/spec/api/#listing-repositories

Sayers answered 20/10, 2020 at 13:55 Comment(0)
D
4

Try this:

microk8s ctr images ls
Desdamonna answered 19/5, 2020 at 4:5 Comment(1)
That returned a lot of information, but I cannot identify the images that were displayed. It returned their sha256 digest wich is not usefulAlesandrini
K
1
microk8s.ctr images ls

Run this to get your images. This is if you had installed microk8s as a snap. I'm using it on Ubuntu Core.

Kathikathiawar answered 16/2, 2023 at 10:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.