Cache on `executorType: machine`

docker
caching

#1

Hello,

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
#2

Hi!

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.

Best,
Lev


#3

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


#4

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


#5

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


#6

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


#7

@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?


#8

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


#9

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


#10

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.


#11

@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?


#12

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.


#13

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?


#14

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


#15

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


#16

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


#17

Hi @reedflinch,

Docker executor might be sufficient for your needs.

You can use docker layer caching with docker executor.

You can mount files using https://circleci.com/docs/2.0/building-docker-images/#mounting-folders

We show the comparision of different executor types on: https://circleci.com/docs/2.0/executor-types/


#20