docker: fast CI rebuilds with --cache-from (intermediate) anthony explains

Поделиться
HTML-код
  • Опубликовано: 1 дек 2024

Комментарии • 7

  • @panteliskaramolegkos2693
    @panteliskaramolegkos2693 Год назад +1

    What are the differences between the --cache-from flag in docker build and the RUN --mount type=cache in the Dockerfile itself? Are BOTH needed to leverage cache?

  • @nilesh-gule
    @nilesh-gule Год назад

    Thanks for the wonderful explanation Anthony. Wish this feature worked with the multistage Dockerfile builds as well.

    • @anthonywritescode
      @anthonywritescode  Год назад +1

      you can! you just need to tag and push all the intermediate images

  • @ndepal
    @ndepal 2 года назад

    Do I need to have pulled the image before or will it be pulled automatically if I don't have it yet? Does this also work with buildx? I think that normally doesn't look at local images as it has its own cache?

    • @anthonywritescode
      @anthonywritescode  2 года назад +1

      you do need to pull yes -- seems to work with buildx as well

    • @ndepal
      @ndepal 2 года назад

      @@anthonywritescode thanks, I don't think the documentation makes this clear. I assumed it looked at the remote since I'm providing a registry url. This could explain some unreliable behavior I've seen in the past with inexplicable cache misses

    • @anthonywritescode
      @anthonywritescode  2 года назад

      yeah the docs for this are abysmal -- they used to be better but I presume the useful context was lost when adding the BUILDKIT stuff