Comments (4)
Having the same issue. I'm trying all of the variously proposed options to get my github action cache to persist across multiple runners, cannot figure it out. So I tried running the build 2 times in the same runner, both times getting this issue where
WARNING: local cache import at /tmp/.buildx-cache not found due to err: could not read /tmp/.buildx-cache/index.json: open /tmp/.buildx-cache/index.json: no such file or directory
Run: https://github.com/mozilla/addons-server/actions/runs/8019019347/job/21906086963?pr=21893
from build-push-action.
You need to set the actions/cache
step in our workflow otherwise cache is not retained across runs. See our docs: https://docs.docker.com/build/ci/github-actions/cache/#local-cache
Tried in this repo through #1066 and looks good to me:
- first run (no index.json as expected): https://github.com/docker/build-push-action/actions/runs/8082221151/job/22082556076#step:7:243
- second run (cache loaded): https://github.com/docker/build-push-action/actions/runs/8082268470/job/22082718550#step:7:170
Also you should consider using the gha
cache backend which is more efficient: https://docs.docker.com/build/ci/github-actions/cache/#github-cache
from build-push-action.
Thanks for testing and pointing to the docs @crazy-max.
I tried your setup, and the cache works for me (replacing /tmp/.buildx-cache
by /tmp/.docker-cache
)
$ du -h /tmp/.docker-cache/
1.6G /tmp/.docker-cache/blobs/sha256
1.6G /tmp/.docker-cache/blobs
4.0K /tmp/.docker-cache/ingest
1.6G /tmp/.docker-cache/
But as soon as I replace this path with ~/.cache/docker-ci
, the caching doesn't work anymore.
That folder remains empty.
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: ~/.cache/docker-ci
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
I tried to remove this folder, and let the workflow create it, but it didn't work either.
So I'm puzzled as to what really happens, and i'm forced to use a path starting with /tmp
here.
Also you should consider using the gha cache backend which is more efficient: https://docs.docker.com/build/ci/github-actions/cache/#github-cache
That solution would be suitable if the cache content wasn't sensitive or private, which is the case here.
from build-push-action.
path: ~/.cache/docker-ci
Don't think actions/cache@v4
expands ~
. You should use an absolute dir.
from build-push-action.
Related Issues (20)
- Support push and load being set together HOT 5
- header key "followpaths" contains value with non-printable ASCII characters HOT 9
- Request for new release HOT 1
- Action hangs after build HOT 3
- net/http: TLS handshake timeout HOT 1
- GHA/Local cache doesn't work HOT 3
- Docker build hangs for `linux/arm/v7` HOT 1
- Ability to use multiple names when using output `type=image` HOT 4
- Caching Multiple Container Builds HOT 1
- Error: buildx failed with: ERROR: failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory HOT 2
- `fatal: Not a valid object name` during `load git source` triggered by `on: push:` (with self-hosted runner) HOT 2
- Not all files present in final build when using `context` HOT 1
- Cache from different multi platform builds doesn't get used HOT 1
- Issue with git clone when the repo include submodules from other repositories HOT 3
- Add support for --progress CLI option
- Use a custom README file for the GitHub package rather than the main project README
- Build image from specific ref HOT 2
- Fail to export cache HOT 6
- x509: certificate signed by unknown authority when importing and exporting cache to self hosted GHE
- buildx failed with: ERROR: attestations are not supported by the current buildkitd HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from build-push-action.