skip to Main Content

I have docker images stored in jFrog artifactory and I need to get the size of those docker images without pulling it. I tried to figure out if there is any direct REST API provided by jFrog but couldn’t find any.

I also tried one solution by doing a curl request to fetch all the docker layers and to sum all the layers. But I’m looking if there is any feasible solution other than the above?

2

Answers


  1. You can try and use regclient.

    It does allow to inspect images without pulling the layers, allowing quick access to the image manifest and configuration.

    And the manifest include the size of the image.
    Start with the regctl manifest command:

    regctl manifest get <yourJFrogName>/<yourImageName>:<tag>
    

    Or:

    regctl image inspect --format '{{jsonPretty .}}' <yourJFrogName>/<yourImageName>:<tag>
    

    It should include the total size:

    $ regctl manifest get localhost:5000/artifact:demo
    Name:        localhost:5000/artifact:demo
    MediaType:   application/vnd.oci.image.manifest.v1+json
    Digest:      sha256:36484d44383fc9ffd34be11da4a617a96cb06b912c98114bfdb6ad2dddd443e2
    Annotations: 
      demo:      true
      format:    oci
    Total Size:  64B
    
    Login or Signup to reply.
  2. JFrog provides a get artifact details REST API where you can get the file size of the image with below REST API.

    curl -u admin -X GET http://localhost:8082/artifactory/api/storage/docker-local/nginx/latest/manifest.json -H "Content-type: application/json"
    

    This will give the following output along with the size.

    {
      "repo" : "docker-local",
      "path" : "/nginx/latest/manifest.json",
      ----------
      "downloadUri" : "https://localhost:8082/artifactory/docker-local/nginx/latest/manifest.json",
      "mimeType" : "application/json",
      "size" : "1570",
      "checksums" : {
        "sha1" : "cc357b563ce443aa8270eb34e6755458a1a46869",
        --------
      },
      "originalChecksums" : {
        "sha256" : "89020cd33be2767f3f894484b8dd77bc2e5a1ccc864350b92c53262213257dfc"
      },
      "uri" : "https://localhost:8082/artifactory/api/storage/docker-local/nginx/latest/manifest.json"
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search