Search code examples
dockerbuildartifactoryartifactory-query-lang

How to get the dockerTag label via the Artifactory API?


I am using Artifactory Version 4.16.0 and need to retrieve the Docker Info Label used to tag my image using the Artifactory API.

The label is definitely set as it appears in the Artifactory UI, under the Docker Info panel, in the Label key-value section.

Using the following API I can see the manifest.json

curl -uadmin:pass https://artifacts.mycompany.com/artifactory/api/storage/my-docker-dev/my-component/my-image-1.0.0-1498449060

but this does not contain the Docker Label I am after. I read the documentation, but cannot figure out how I can achieve this.


Solution

  • The access the build properties, which include the Docker labels, the name of the artefact must be followed by /manifest.json?properties

    e.g.: curl -uadmin:pass https://artifacts.my-company.com/artifactory/api/storage/my-docker-dev/my-component/my-image-1.0.0-1498449060/manifest.json?properties

    returns something like

    { "properties" : { "docker.label.com.my-company.repository.commit.full" : [ "4fb524c0cb2139b15074b348bddb1952fa68deb1" ], "docker.label.com.my-company.repository.commit.short" : [ "4fb52" ], "docker.manifest" : [ "develop-1.0.0-1498449060" ], "docker.manifest.type" : [ "application/vnd.docker.distribution.manifest.v2+json" ], "docker.repoName" : [ "my-component" ], "sha256" : [ "0c8f855fbd7f6065972eec9a8ca7e48980f19sd3db07c47751bbe17043ddda4d" ] }, "uri" : "https://artifacts.my-company.com/artifactory/api/storage/my-docker-dev/my-component/develop-1.0.0-1498449060/manifest.json" }