How can I remove my cached docker layers?


You may run into issues with cached docker layers when using them within your config.
If necessary, you can try removing (purging) the cached layers.


Remove the layers

Note: The underlying implementation of DLC is in the process of being updated.
All further content on this page refers to the implementation of DLC that is in the process of being phased out.
Once all jobs have been migrated to the new implementation, the content currently on this page will become outdated and will be replaced with information based on the new architecture.

Running docker images --no-trunc --format '{{.ID}}' | xargs docker rmi or docker volume prune -f will delete all of the images and their layers from the volume connected to your job.

Because of how Docker Layer Caching (DLC) works you might need to leave this command in your config and run several jobs to remove the Docker Layer Caching (DLC) layers from all volumes associated with your project.

You can use the config below to run a one-time job that consumes all 30 DLC volumes and purges docker caches. You can push it to a feature branch without disrupting your main branches:

version: 2.1
- image: cimg/base:2020.01
parallelism: 30
- setup_remote_docker
- run: docker volume prune -f

Stale volumes

If you're running into issues of stale volumes somehow, consider using our new docker registry image cache orb.

Was this article helpful?
27 out of 72 found this helpful



Article is closed for comments.