Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-26179

Artifactory cannot be used as a BuildKit remote cache

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Ready for Code Review
    • Priority: 4 - Normal
    • Resolution: Unresolved
    • Affects Version/s: 7.21.7
    • Fix Version/s: None
    • Component/s: Docker
    • Labels:
      None
    • Environment:

      Local environment:

      • OS: Ubuntu 20.04.2 LTS
      • Docker Version: 20.10.7

      Artifactory Version: 7.21.8

    • Location:
      External

      Description

      Docker image build tool BuildKit can use Docker Registry as a remote build cache: https://github.com/moby/buildkit#registry-push-image-and-cache-separately

      Unfortunately, Artifactory is not compatible with this feature.

      How to reproduce

      Create Dockerfile with content:

       

      FROM busybox:latest
      RUN echo "Hello, world!!!"

       

      Run command like: 

       

      #!/bin/bash
      REGISTRY=artifactory.example.net/test-docker/example
      docker run \
       --rm \
       -it \
       --privileged \
       -v $(pwd):/tmp/work \
       -v $HOME/.docker:/root/.docker \
       --entrypoint buildctl-daemonless.sh \
       moby/buildkit:v0.9.0 \
       build \
       --frontend dockerfile.v0 \
       --local context=/tmp/work \
       --local dockerfile=/tmp/work \
       --progress plain \
       --import-cache type=registry,ref=${REGISTRY}:buildcache \
       --export-cache type=registry,ref=${REGISTRY}:buildcache,push=true,mode=max \
       --output type=image,name=${REGISTRY}:latest,push=true

       

      Expected result

      Command completed sucessfully

      Actual result

      Build failed with error like:

       

      #8 exporting to image
      #8 pushing layers 0.7s done
      #8 pushing manifest for artifactory.example.net/test-docker/example:latest@sha256:fa18d5f75f92c19cb1ba239bd059dd551d6007694a2d681b7d513884bde6d0a5
      #8 pushing manifest for artifactory.example.net/test-docker/example:latest@sha256:fa18d5f75f92c19cb1ba239bd059dd551d6007694a2d681b7d513884bde6d0a5 0.5s done
      #8 DONE 1.5s
      #12 exporting cache
      #12 preparing build cache for export 0.0s done
      #12 writing layer sha256:b71f96345d44b237decc0c2d6c2f9ad0d17fde83dad7579608f1f0764d9686f2
      #12 writing layer sha256:b71f96345d44b237decc0c2d6c2f9ad0d17fde83dad7579608f1f0764d9686f2 0.1s done
      #12 writing layer sha256:ee8d7f86d1f90694b6410247c1895632739009a59e080673b29965a808ce63f9 0.1s done
      #12 writing config sha256:2f8e49086de6ee9255833bfe7191deb2f5966dc9aa824288f0091f54a593bc19
      #12 writing config sha256:2f8e49086de6ee9255833bfe7191deb2f5966dc9aa824288f0091f54a593bc19 0.3s done
      #12 writing manifest sha256:36716a9180f8189f16dec3c52031d0c0afcd32f036930ba9e8ffaf6b76c99e23
      #12 writing manifest sha256:36716a9180f8189f16dec3c52031d0c0afcd32f036930ba9e8ffaf6b76c99e23 0.1s done
      #12 ERROR: error writing manifest blob: failed commit on ref "sha256:36716a9180f8189f16dec3c52031d0c0afcd32f036930ba9e8ffaf6b76c99e23": unexpected status: 400 Bad Request
      ------
       > importing cache manifest from artifactory.example.net/test-docker/example:buildcache:
      ------
      ------
       > exporting cache:
      ------
      error: failed to solve: error writing manifest blob: failed commit on ref "sha256:36716a9180f8189f16dec3c52031d0c0afcd32f036930ba9e8ffaf6b76c99e23": unexpected status: 400 Bad Request
      

      Related error in /opt/jfrog/artifactory/var/log/console.log:

      #62428:2021-07-25T21:14:20.461Z [jfrt ] [INFO ] [30fd0c627473d3bd] [h.DockerManifestPutHandler:103] [ttp-nio-8081-exec-12] - Deploying docker manifest for image 'example' and tag 'buildcache' in repo 'test-docker'
      #62429:2021-07-25T21:14:20.461Z [jfrt ] [ERROR] [30fd0c627473d3bd] [h.DockerManifestPutHandler:374] [ttp-nio-8081-exec-12] - Error uploading manifest: 'N/A (through reference chain: org.jfrog.repomd.docker.manifest.ManifestListJson["manifests"]->java.util.ArrayList[0]->org.jfrog.repomd.docker.manifest.ManifestListJson$ManifestJson["annotations"])'

      Workaround

      Use stock Docker Registry (https://docs.docker.com/registry/deploying/) for docker image build cache.

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            bozaro Artem Navrotskiy
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Sync Status

                Connection: RTFACT Sync
                RTMID-26180 -
                SYNCHRONIZED
                • Last Sync Date: