Skip to content

Output cache hit / miss layer count on build #2223

@devonwarren

Description

@devonwarren

Description

It would be very nice to be able to easily track how many layers were cached vs missed during a build. I would like to use this information to track cache performance in our CI system. Can this be added as an option for buildx build?

Something like docker buildx build -f Dockerfile . --cache-report=cache-report.json

cache-report.json:

{
  "overall" : {
    "misses": 2,
    "hits": 1
  },
  "cached_layers": [
    {
      "layer_number": 1,
      "layer_id": 18fb1a987c75191231,
      "type": "FROM",
      "command":  "FROM ubuntu"
    }
  ],
  "missed_layers": [
    {
      "number": 2,
      "id": aabc7757571bca,
      "type": "COPY",
      "command": "COPY ./src ./src",
    },
    {
      "number": 3,
      "id": aabc3891a57571bca,
      "type": "RUN",
      "command": "RUN ./script.sh",
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions