Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does any CI service let you build Docker containers and use the docker build cache?

Tags:

I have a bunch of Docker containers all hooked up using docker-compose (previously fig). I have found that services that advertise themselves as "Docker CI" services are usually just talking about using Docker to run their build workers.

I would like a continuous integration service that preserves the Docker build cache between runs, instead of spinning up a completely new worker/filesystem/build context. Otherwise, builds take absolutely forever. Ideally managed (unlike https://github.com/groupon/DotCi, which doesn't come with CircleCI's ready-to-go per-build database).

The only thing I've found is TeamCity (old, you can't version build tasks in a yaml file easily like you can with CircleCI, you have to maintain infrastructure, etc). Quay.io doesn't provision a database like CircleCI and Travis do, so you have to bifurcate dev and prod and install one inside the container and run unit tests during the container build (ew - you can't spawn into an unbuilt container to debug things!).

How do you run continuous integration on your Docker container cluster?

like image 447
user3906849 Avatar asked Jan 28 '15 20:01

user3906849


People also ask

Does Docker build cache?

Docker's build-cache is a handy feature. It speeds up Docker builds due to reusing previously created layers. You can use the --no-cache option to disable caching or use a custom Docker build argument to enforce rebuilding from a certain step.

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.

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.

How CI CD works with Docker?

How to implement a CI/CD pipeline in the codebase using a CircleCI config file in the project. Building a Docker image. Pushing the Docker image to Docker Hub. Kicking off a deployment script which will run the application in Docker container on a Digital Ocean server.


2 Answers

CircleCI 1.0

CircleCI lets you build Docker containers as part of your build: https://circleci.com/integrations/docker

You are however right that this doesn't cache the Docker images - it's a bit tricky on our stack to do that right, but we are planning on addressing that soon.

In the meantime, a number of customers have cached it using CircleCI's built-in (non-Docker) caching, by using docker save/docker load: https://circleci.com/docs/docker#caching-docker-layers. It's not ideal, but it should tide you over until we're able to support this a lot better.

Updated for CircleCI 2.0

CircleCI 2.0 is Docker-centric. You can build Docker images, utilize layer caching, use Docker Compose, and even use official and custom Docker images as your build environment.

like image 67
Paul Biggar Avatar answered Oct 11 '22 22:10

Paul Biggar


I'm currently using CircleCI, see http://tschottdorf.github.io/cockroach-docker-circleci-continuous-integration for a good guide to use the docker cache

shippable is also worth checking out, as their entire infrastructure is based around docker and orchestrating multiple docker containers with shippable formations.

like image 32
d3ming Avatar answered Oct 12 '22 00:10

d3ming