Note: The Docker images used for CircleCI 2.0 job runs are automatically cached on the server infrastructure where possible.
But in the Spin up Environment step of the build, we always got this:
Build-agent version 0.1.1480-7a5183d3 (2019-01-22T18:14:45+0000)
Starting container ecr.foo.amazonaws.com/elixir:1.8.0
image cache not found on this host, downloading ecr.foo.amazonaws.com/elxir:1.8.0
Is this correct? There is some particular requirement for images to be cached?
This is correct. Images are cached on the Nomad node that runs your docker instance. If another job with the same image occurs on the same node (assuming the container has auth access to the image) it will be able to pull from the local cache rather than re-downloading. This will only ocurr if your job happens to occur on the same node though. If you use a highly used image as your image’s base, like our CircleCI convenience images, there is a high likelkhood that you will find many cached layers as many users are likely to also be using the same layers.
With a completely custom image it is unlikely you will often run into a valid cache for your own image. If you were to build on top of a CircleCI convenience image (If that was a valid option for your use case) you will likely see improvement.
The convenience images are based on upstream docker images which for now are based on debian. Ubuntu is also debian based, so unless you need ubuntu for a very specific reason any of the convenience images should work just fine for you.