devcontainer ci image cache is never working
In dc github action I have
- name: Dev Container Build and Run Action
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/${{ github.repository_owner }}/devcontainers
imageTag: latest
runCmd: |
mvn --version
whoami
ls -lash /home/vscode
echo "Dev Container can start up! Let's push!"
this builds and pushes the DC.
In deploy github action I have:
- name: Dev Container Build and Run Action
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/${{ github.repository_owner }}/devcontainers
cacheFrom: ghcr.io/${{ github.repository_owner }}/devcontainers
# platform: linux/amd64,linux/arm64
push: never
runCmd: |
whoami
ls -lash /home/vscode/
< then a lot more things>
This always rebuilds the container instead of loading it from cache.
What am I doing wrong?
See #299 #300
Has anyone actually managed to get this to work recently? I've read both the above issues and the blog post and still cannot get this to work in my CI workflow. I notice the repo linked in the blog post does not actually show using the caching either.
I'm trying to build a devcontainer image that is then used by the repo's docker-compose.yaml to set up a multi-container development environment. The files to build the apps (primary) image are under .devcontainer/apps:
It builds perfectly fine in CI, but I cannot get caching to work at all:
- name: Build dev container
if: steps.changed-files.outputs.devcontainer_any_changed == 'true'
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/${{ github.repository }}-devcontainer
cacheTo: type=registry,ref=ghcr.io/${{ github.repository }}-devcontainer:cache
configFile: .devcontainer/apps/devcontainer.json
refFilterForPush: refs/heads/main
push: filter
This results in:
[2025-04-21T15:04:18.609Z] ERROR: Cache export is not supported for the docker driver.
Switch to a different driver, or turn on the containerd image store, and try again.
Learn more at https://docs.docker.com/go/build-cache-backends/
My CI runs on ubuntu-latest