---
title: Use Docker Build Cloud in CI
linkTitle: Continuous integration
weight: 30
description: Speed up your continuous integration pipelines with Docker Build Cloud in CI
keywords: build, cloud build, ci, gha, gitlab, buildkite, jenkins, circle ci
aliases:
- /build/cloud/ci/
---
Using Docker Build Cloud in CI can speed up your build pipelines, which means less time
spent waiting and context switching. You control your CI workflows as usual,
and delegate the build execution to Docker Build Cloud.
Building with Docker Build Cloud in CI involves the following steps:
1. Sign in to a Docker account.
2. Set up Buildx and connect to the builder.
3. Run the build.
When using Docker Build Cloud in CI, it's recommended that you push the result to a
registry directly, rather than loading the image and then pushing it. Pushing
directly speeds up your builds and avoids unnecessary file transfers.
If you just want to build and discard the output, export the results to the
build cache or build without tagging the image. When you use Docker Build Cloud,
Buildx automatically loads the build result if you build a tagged image.
See [Loading build results](./usage/#loading-build-results) for details.
> [!NOTE]
>
> Builds on Docker Build Cloud have a timeout limit of 90 minutes. Builds that
> run for longer than 90 minutes are automatically cancelled.
## Setting up credentials for CI/CD
To enable your CI/CD system to build and push images using Docker Build Cloud, provide both an access token and a username. The type of token and the username you use depend on your account type and permissions.
- If you are an organization administrator or have permission to create [organization access tokens (OAT)](../security/for-admins/access-tokens.md), use an OAT and set `DOCKER_USER` to your Docker Hub organization name.
- If you do not have permission to create OATs or are using a personal account, use a [personal access token (PAT)](/security/for-developers/access-tokens/) and set `DOCKER_USER` to your Docker Hub username.
### Creating access tokens
#### For organization accounts
If you are an organization administrator:
1. Create an [organization access token (OAT)](../security/for-admins/access-tokens.md):
- The token must have these permissions:
- **cloud-connect** scope
- **Read public repositories** permission
- **Repository access** with **Image push** permission for the target repository:
- Expand the **Repository** drop-down.
- Select **Add repository** and choose your target repository.
- Set the **Image push** permission for the repository.
If you are not an organization administrator:
- Ask your organization administrator for an access token with the permissions listed above, or use a personal access token.
#### For personal accounts
1. Create a [personal access token (PAT)](/security/for-developers/access-tokens/):
- Create a new token with **Read & write** access.
- Note: Building with Docker Build Cloud only requires read access, but you need write access to push images to a Docker Hub repository.
## CI platform examples
> [!NOTE]
>
> In your CI/CD configuration, set the following variables:
> - `DOCKER_PAT` — your access token (PAT or OAT)
> - `DOCKER_USER` — your Docker Hub username (for PAT) or organization name (for OAT)
>
> This ensures your builds authenticate correctly with Docker Build Cloud.
### GitHub Actions
```yaml
name: ci
on:
push:
branches:
- "main"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USER }}
password: ${{ secrets.DOCKER_PAT }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: cloud
endpoint: "<ORG>/default"
install: true
- name: Build and push
uses: docker/build-push-action@v6
with: