Shared cache drives for Docker CLI

January 6, 2022

Shared cache drives for Docker CLI

At the end of 2021 we added a new action called Docker CLI. The action launches in a VM with preinstalled Docker and docker-compose, and terminates as soon as the action finishes.

This week, we upgraded this feature by adding the cache for Docker images, layers, and containers. This way, all images that you pull or build will be available for future pipeline executions. The functionality also allows you to transfer the cache between actions and pipelines. For example, you can build the image on the VM in one action, and then push it to the selected registry in another one.

What you need to know

  • To enable the cache, check the option 'Attach cache drive to VM running this action'.
  • To share the cache with other actions and pipelines, check 'Use shared cache drive'. You'll notice that new options have appeared allowing you to set the sharing scope (workspace > project > pipeline) and to define the tag for this cache.

In order to share the cache between different Docker CLI actions, make sure the sharing scope and the tag is the same in both of them.

How it works

The VM on which your run the commands defined in the Docker CLI action has a drive mounted to the /var/lib/docker tab. If you run a second Docker CLI action with the same sharing scope and tag, Buddy will mount that same drive to the second VM.

Running actions in parallel

The disk retention period is 7 days. If you run two actions using the same cache in parallel, the first one will use the existing drive, and the second one will create a new drive. If you run these two actions again, they will utilize the two separate drives respectively (unless the break between executions is more than 7 days).

Clearing pipeline cache

If you clear the pipeline cache (e.g. run it from scratch), Buddy will remove all cache drives used in this pipeline – even if they're shared with actions in other pipelines. The exception to this is the Clear Cache action in which you can precisely define what should be purged.


Please be aware that if you run a container in action – for example, by running docker run --name my-redis -d redis – and will not remove it manually in the end, the container image will remain in the cache. This means that running the command again will throw an error like this:

docker: Error response from daemon: Conflict. The container name "/my-redis" is already in use`.

If you want to use the same container in subsequent actions, make sure to launch them using docker start, for example:

docker start my-redis
Each shared drive attached to the Docker VM has 10 GB of space. If you need more, please contact our support team.


Alexander Kus

Alexander Kus

Customer Success Manager

A story-teller and conversation-lover, Alexander decided to invest his skills to help his friends at Buddy transform the cold language of patch notes into exciting narratives. Also: an avid gamer, hip-hop DJ, Liverpool FC fan, absentminded husband, and the father of two.