ARTIFACTORY: Retrieving Docker Labels using manifest.json in Artifactory via REST API call

ARTIFACTORY: Retrieving Docker Labels using manifest.json in Artifactory via REST API call

Products
Frog_Artifactory
Content Type
REST_API
AuthorFullName__c
Krishna Valluri
articleNumber
000006406
ft:sourceType
Salesforce
FirstPublishedDate
2025-04-15T13:40:38Z
lastModifiedDate
2025-04-15
VersionNumber
2
When Docker images are pushed or pulled via JFrog Artifactory, metadata such as Docker labels are stored alongside the image files. These labels are embedded in the manifest.json file and are accessible via Artifactory UI. These Docker labels are stored in Artifactory as custom properties on the manifest.json file of a Docker image. These properties are prefixed with docker.label.

The below command will be helpful to retrieve docker labels via REST API call without requiring access to the Artifactory UI and further helpful for any automated jobs as well.

The REST API call follows Get Item Properties REST API endpoint and requires ‘jq’ CLI to filter the docker labels explicitly.

Below is the REST API command for a reference
$ curl -u<username> -X GET "https://artifactory.com/artifactory/api/storage/<repo-name>/image/tag/manifest.json?properties" \
| jq '.properties | to_entries | map(select(.key | startswith("docker.label."))) | from_entries'
Example:-

Screenshot of docker labels for a docker image from Artifactory UI
User-added image 



Sample REST API call and it output
$ curl -u<username> -X GET "http://localhost:8082/artifactory/api/storage/docker-local/ubuntu/test/manifest.json?properties" \
| jq '.properties | to_entries | map(select(.key | startswith("docker.label."))) | from_entries'


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   773    0   773    0     0   1184      0 --:--:-- --:--:-- --:--:--  1183

{
  "docker.label.org.opencontainers.image.ref.name": [
    "ubuntu"
  ],
  "docker.label.org.opencontainers.image.version": [
    "24.04"
  ]
}
Refer to this Docker Labels document for more details.