This blog series covers three Docker in Continuous Integration (CI) scenarios. A CI process combined with immutable Docker images expedites delivering software changes. The three scenarios covered in this series are:

Use an existing Docker image.

Build your own Docker image.

Push a Docker image to a registry of your choice.

In this blog, I'll cover the first scenario.

Use an existing Docker image in your CI process with either of the following two options. We'll look at each options, see when to use them, list out steps you should take, and give examples.

When to Use This Option

Steps

Specify the language, the version (optional), and the service (optional) that you need in the shippable.yml file. Based on your input, the platform automatically chooses the best default image for your CI process.

Sample shippable.yml:

language: node_js
node_js:
- 0.12
build:
ci:
- npm install

Example

Use this tutorial to run Continuous Integration for a simple Node.js application. This example pulls a default Node.JS Docker image for the CI process.

Your Own Custom Docker Image

Specify your private Docker image to run your build. Shippable will start the build container from your Docker image and run the CI process.

When to Use This Option

Override Shippable's default image with your own custom Docker image.

Set specific options for booting up the default build container for the CI process.

options: Enter Docker options for use in the docker run command. You can also include Home environment variable as shown, if it isn't set in your image.

integrationName: Replace docker-hub with the name of the Docker integration you created in Step 4.

type: docker This value specifies it is a Docker registry integration.

branches (optional): Skip this for your integration to be applicable to all branches. In this example, it is applicable only to the master branch.

Commit the shippable.yml changes, which automatically triggers a build on Shippable.

Shippable pulls your Docker image from Docker hub and uses it in the CI process. A successful build is shown below:

Important Note

You can combine each option with Push a Docker image to a registry of your choice (Scenario #3) in your CI process. We'll go over this combination of scenarios in a later post.

Conclusion

You can use Shippable's default Docker images in your CI process when you don't use Docker or the default images fulfill your requirements. Use your own custom Docker image in your CI process when you want to override the default images or set specific options to boot the build container.

In the next blog, we'll go over Scenario #3: Build your own Docker image.