ARTIFACTORY: How To Set Properties for Docker Images

ARTIFACTORY: How To Set Properties for Docker Images

AuthorFullName__c
Sam Rosenstein
articleNumber
000005443
ft:sourceType
Salesforce
FirstPublishedDate
2022-10-25T09:18:25Z
lastModifiedDate
2024-03-10T07:44:55Z
VersionNumber
3

A useful feature of Artifactory is the ability to assign properties for artifacts or repositories. This allows the user to attribute custom properties to images for various development purposes.

One unique use case is setting properties for Docker images. As Docker images contain many layers, there are cases where Artifactory treats an image as a folder that contains many artifacts. This is the case when setting properties. 

Based on this, in order to set a property for an entire image, we need to treat the image as a folder. For example, let’s say we want to add the following property:

a=1
to the following image:
docker-local/nginx/1.21.1/

In this example, we will use the Set Property command from the JFrog CLI. The key here is to add the --include-dirs flag which will apply the property on all of the layers within the image tag:
 $ jf rt sp  --include-dirs "docker-local/nginx/1.21.1" "a=1"