AQL Query to get all images in local docker repository

 

How to get the list of all the images which are stored on my local docker repository in Artifactory.

This can be done by using AQL with a property criteria (See here about properties in general).

 

This is the AQL query:

items.find(

{

"repo":{"$eq":"<docker repository name>"},

 

 

"@docker.repoName" : { "$eq" : "*" }

}

).include("name", "@docker.repoName", "@docker.manifest" ,"stat.downloads")

 

Whereas the property 'docker.repoName' is the same name used to tag the image before it was pushed to the repository and the 'docker.manifest' is the image's version.

 

 

 

 

 

 

Running the REST api call:

 

curl -u <user> -i -X POST http://localhost:8081/artifactory/api/search/aql -H "content-type: application/json" -T dockerImagesExample.json

 

Will provide the following output:

 

"results" : [

 

{

"name" : "manifest.json",

"properties" : [ {

"key" : "docker.manifest",

"value" : "latest"

}, {

"key" : "docker.repoName",

"value" : "mysql"

} ],

"stats" : [ {

"downloads" : 0

} ]

} ....