Cache on `executorType: machine`




I’m starting to play with CircleCi 2.0 and will be using executorType: machine to build and test our projects.

We are currently using docker-compose on CircleCi 1.0, so, we are going to try to use the same strategy for 2.0. Our biggest pain right now with 1.0 is that caching doesn’t work, so, we need to build our images on every build :(.

My question is, for executorType machine in 2.0, cache should work out of the box ? Do I need to provide any special instruction to cache our built images ?

Thanks for the help!

Docker machine executor cache workaround


Image layer caching is not yet supported. I am moving this to the “Feature Request” category so that we can keep better track of it.



Does the “old way” of caching layers work on machine executor?


The old way being something like this? If so, yes it should work.


I mean the load/save commands. They are still broken in the machine executor docker engine version?


The load/save commands do not exist in 2.0 just yet.


@levlaz I’m also wondering about this. I am using circle 2.0, with executorType: machine. When using docker-compose, my images need to be built every time from scratch. Is this expected behavior?


For the moment the layers cache is not working, so, yes I guess it is the expected behavior :frowning:


Gotcha, I thought this fell under the umbrella of ‘first class docker support in circle 2.0’. Hope this gets implemented soon, will make a big difference to my project’s speed


That’s good && fair feedback - thanks.

We do have layer caching available for executorType: docker. You just need to contact your CSM to gain access to it.


@rohara So if I understand the situation correctly, if I want to use layer caching I’ll have to use executorType: docker, in which case I need to be running ‘docker-in-docker’ by installing docker within my own build image. Is that correct?


That is correct.

Just to be clear, the Docker containers in this context will not be running within the container from which you are executing the commands. The socket is shared from a VM.


Thank you @rohara.

I apologize if this is slightly off topic, but if I want Docker layer caching ( executorType: docker) AND be able to mount files from my build directory to containers (i.e. executorType: machine, if I’m reading correctly), am I screwed?


No, I don’t think that will work.
But you can certainly do that from the machine.


I’m not sure which point you’re referring to. I can’t accomplish both of those goals, can I?


For now, that is correct. As far as I understand, layer caching will be available on the machine, but not yet.


Hi @reedflinch,

Docker executor might be sufficient for your needs.

You can use docker layer caching with docker executor.

You can mount files using

We show the comparision of different executor types on: