Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Travis CI cache docker images?

Tags:

Is it possible to add a setting to cache my docker image anywhere in the travis configuration ? Mine is a bigger docker image and it takes a while for it to download.

Any suggestions ?

like image 866
Naga Avatar asked Sep 30 '15 12:09

Naga


People also ask

Are Docker images cached?

The concept of Docker images comes with immutable layers. Every command you execute results in a new layer that contains the changes compared to the previous layer. All previously built layers are cached and can be reused.

Does Travis CI use Docker?

Travis CI builds can run and build Docker images, and can also push images to Docker repositories or other remote storage. Then you can add - docker commands to your build as shown in the following examples. We do not currently support use of Docker on macOS.

Does Github actions cache Docker images?

Docker build-with-cache action. This action builds your docker image and caches the stages (supports multi-stage builds) to improve building times in subsequent builds.

Does Jenkins cache Docker images?

Still the bottom line is: Jenkins does not cache automagically for you. Caching is inside the scope of the build tool(s) that you are using. You have to take care to incorporate that properly to your CI environment's needs. But of course it is possible to achieve.


1 Answers

Simplest solution today (October 2019) is to add the following to .travis.yml:

cache:   directories:   - docker_images  before_install: - docker load -i docker_images/images.tar || true  before_cache: - docker save -o docker_images/images.tar $(docker images -a -q) 
like image 181
SColvin Avatar answered Oct 14 '22 23:10

SColvin