Cloud builders

Cloud builders are container images with common languages and tools installed in them. You can configure Cloud Build to run a specific command within the context of these builders.

This page describes the types of builders that you can use with Cloud Build.

Publicly available images

Cloud Build enables you to use any publicly available image to execute your tasks. To use an image, specify the image URL in the name field in your config file. Use the args field to specify commands that you want to run within the image. The args field of a build step takes a list of arguments and passes them to the image referenced by the name field.

The following code snippet shows how to use the public ubuntu image from Docker Hub and execute a command within that image:

steps:
- name: 'ubuntu'
  args: ['echo', 'hello world']

Here's another example code snippet that uses the image for Black Duck open source scanner for Cloud Build from Google Cloud console Launcher:

steps:
- name: launcher.gcr.io/blackduck-public/blackducksoftware-containerbuilder-scanner
  ...

For more examples on how to use publicly available images from Docker Hub for your tasks, see Building Node.js applications and Building Go applications.

Supported builder images provided by Cloud Build

Cloud Build provides and maintains pre-built images that you can reference in your config file to execute your tasks. You can find these pre-built images in the following location:

gcr.io/cloud-builders/...

The source code for these builders is available in the cloud builders GitHub repository.

For examples on how to use supported pre-built images, see Building container images and Deploying to Cloud Run.

The following table lists some examples of supported builder images:

Builder Name Example
bazel gcr.io/cloud-builders/bazel bazel example
docker gcr.io/cloud-builders/docker docker example
git gcr.io/cloud-builders/git git example
gcloud gcr.io/cloud-builders/gcloud gcloud example
gke-deploy gcr.io/cloud-builders/gke-deploy gke-deploy example
gradle gcr.io/cloud-builders/gradle gradle example
maven gcr.io/cloud-builders/mvn maven example
The complete list of supported builders for Cloud Build.

Community-contributed builders

The Cloud Build developer community provides open-source builders that you can use to execute your tasks. Pre-built images are not available for these builders; to use these builders, download the source code from the cloud builders community GitHub repository and then build the image. For an example on how to build a community-contributed builder and then use it for your tasks, see Building VM images using Packer.

The following table lists some examples of community-contributed builders:

Builder Description
docker-compose Runs integration tests on docker images.
harness-chaos Launch chaos experiments and test the resilience of applications with Harness Chaos Engineering.
helm Manages Kubernetes packages using Helm.
kaniko Executes your build step using kaniko.
pack Executes your build step using the specified Cloud Native Buildpack.
packer Automates the creation of machine images using Packer.
remote-builder Executes your build step on a configurable Compute Engine VM.
The complete list of community-contributed builders for Cloud Build.

Community-contributed builders are maintained by the open-source community at cloud builders community. Cloud Build does not officially maintain these builders. For information on contributing to a builder, see the cloud builders community GitHub page.

Writing your own custom builder

You can create your own custom builder for use in your builds. A custom builder is a container image that the Cloud Build pulls and runs with your source. Your custom builder can execute any script or binary inside the container; as such it can do anything a container can do. For instructions on creating a custom builder, see Creating custom build steps.

What's next