Search code examples
dockerartifactoryjfrog-container-registry

how to set repoLayoutRef by code for remote docker


When declare remote docker repository inside docker by using yaml file (see https://www.jfrog.com/confluence/display/JFROG/Artifactory+YAML+Configuration) I'm not able to set repoLayoutRef to simple-default. if I want to save his definition by GUI I see that repoLayoutRef definition must be set so I suppose it's mandatory. If the repoLayout is not set the docker remote repository doesn't works.

The yaml file doesn't allow to set it

I try with content of param.yaml

remoteRepositories
  docker-via-intranet:
    type: docker
    url: https://dockerproxy.mydomain
    proxy: intranet-proxy
    enableTokenAuthentication: true
export BASE_URL="http://localhost:8081/artifactory"
export AUTH=" -u admin:((jcr_admin_password))"

curl $AUTH -X PATCH "http://localhost:8081/artifactory/api/system/configuration" -H "Content-Type:application/yaml" -T param.yml

If I look inside the yaml generated I can see that the mandatory field is not present :
<repoLayoutRef>simple-default<repoLayoutRef>

see:

      <remoteRepository>
            <key>docker-via-intranet</key>
            <type>docker</type>
            <includesPattern>**/*</includesPattern>
            <dockerApiVersion>V2</dockerApiVersion>
            <forceNugetAuthentication>false</forceNugetAuthentication>
            <blackedOut>false</blackedOut>
            <handleReleases>true</handleReleases>
            <handleSnapshots>true</handleSnapshots>
            <maxUniqueSnapshots>0</maxUniqueSnapshots>
            <maxUniqueTags>0</maxUniqueTags>
            <blockPushingSchema1>true</blockPushingSchema1>
            <suppressPomConsistencyChecks>true</suppressPomConsistencyChecks>
            <propertySets/>
            <archiveBrowsingEnabled>false</archiveBrowsingEnabled>
            <url>https://registry-1.docker.io/</url>
            <offline>false</offline>
            <hardFail>false</hardFail>
            <storeArtifactsLocally>true</storeArtifactsLocally>
            <fetchJarsEagerly>false</fetchJarsEagerly>
            <fetchSourcesEagerly>false</fetchSourcesEagerly>
            <retrievalCachePeriodSecs>7200</retrievalCachePeriodSecs>
            <assumedOfflinePeriodSecs>300</assumedOfflinePeriodSecs>
           <unusedArtifactsCleanupPeriodHours>0</unusedArtifactsCleanupPeriodHours>
            <shareConfiguration>false</shareConfiguration>
            <synchronizeProperties>false</synchronizeProperties>
            <listRemoteFolderItems>true</listRemoteFolderItems>
            <rejectInvalidJars>false</rejectInvalidJars>
            <blockMismatchingMimeTypes>true</blockMismatchingMimeTypes>
            <bypassHeadRequests>false</bypassHeadRequests>
            <allowAnyHostAuth>false</allowAnyHostAuth>
            <socketTimeoutMillis>15000</socketTimeoutMillis>
            <enableCookieManagement>false</enableCookieManagement>
            <enableTokenAuthentication>false</enableTokenAuthentication>
            <proxyRef>internet-proxy</proxyRef>
            <propagateQueryParams>false</propagateQueryParams>
        </remoteRepository>

Solution

  • You should use the "repoLayout" parameter to set the repository layout, for example:

    remoteRepositories:
      test-docker:
        type: docker
        url: https://dockerproxy.mydomain
        enableTokenAuthentication: true
        repoLayout: simple-default