Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output cache hit / miss layer count on build #2223

Closed
devonwarren opened this issue Jan 30, 2024 · 2 comments
Closed

Output cache hit / miss layer count on build #2223

devonwarren opened this issue Jan 30, 2024 · 2 comments

Comments

@devonwarren
Copy link

devonwarren commented Jan 30, 2024

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",
    }
  ]
}
@jedevc
Copy link
Collaborator

jedevc commented Feb 1, 2024

Linking to moby/buildkit#4464, which added something very similar like this to buildctl.

@tonistiigi
Copy link
Member

We have added the info about a number of build steps and cached build steps to the history API. This is saved for every build (all buildx builds) and can be inspected in Docker Desktop build views https://docs.docker.com/desktop/use-desktop/builds/ (raw data can also be pulled in buildctl).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants