BACKGROUND IMAGE: iSTOCK/GETTY IMAGES
With the rise of DevOps, continuous integration tools came to prominence. The leading CI tool, of course, is Jenkins. But there are other capable ones like CircleCI and GitLab CI. Let's look at why you would want to integrate Docker with one of these CI tools and how you can get started with the integration.
Why integrate Docker with your CI tool?
DevOps is about moving to continuous integration and continuous delivery (CD). This means every step of the software lifecycle should be programmatic, repeatable and automated. This is not possible if your dev, quality assurance and ops teams work in silos. They need to be integrated using a common platform -- a CI tool and a common way to package applications -- like Docker.
Once integrated, you can use the same containers consistently across dev, test and production and avoid the annoying "works on my machine" syndrome.
It's easy to get started with CI process, but extending it to CD isn't as easy. If you plan on graduating from CI to CD, you need to integrate Docker with your CI tool.
What happens when you integrate them?
Here's a flow of what happens when your CI tool and Docker work together across your development pipeline.
These are the actions your CI tool takes, in order:
- Builds the Docker image from your repository
- Tests the Docker image against your test suite
- Pushes the Docker image to Docker Hub or a private registry
- Deploys the image to a cloud host
As you can see, integrating Docker with your CI tool benefits your entire development pipeline from development to production.
How to integrate Docker with CI tools
Jenkins uses a bunch of plug-ins to integrate with Docker. Here's the list of plug-ins:
- Jenkins Cloud Plugin for Docker
- CloudBees Docker Traceability
- CloudBees Docker Hub Notification
- CloudBees Docker Build and Publish
- CloudBees Docker Pipeline
Each of these plug-ins serves a different purpose across the pipeline.
CircleCI doesn't use plug-ins, instead it requires you to work with a circle.yml file. You'll need to make Docker a required service in your circle.yml file by adding the following text to it:
Once enabled, you can use Docker commands throughout your circle.yml file. This includes commands like docker build, docker pull and docker push. The commands will be automatically triggered based on events that your CI tool watches for.
Integrating Docker and your CI tool is a vital step in your move to DevOps. It brings consistency and the power of automation across your pipeline. We looked at how to get setup with two popular CI tools -- Jenkins and CircleCI. You can find similar how-to information for other CI tools as well. Build apps the DevOps way by integrating Docker and your CI tool today.
What are the benefits of containers with Docker?
The drawbacks of Docker instances
Is your CI process working?