> For the complete documentation index, see [llms.txt](https://docs.earthly.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.earthly.dev/earthly-0.7/ci-integration/vendor-specific-guides/bitbucket-pipelines-integration.md).

# Bitbucket Pipelines

Bitbucket Pipelines run in a shared Docker environment and do not support running Earthly builds directly due to [restrictions](https://jira.atlassian.com/browse/BCLOUD-21419) that Bitbucket has put in place.

You can however, run Earthly builds on Bitbucket pipelines via [remote runners](/earthly-0.7/docs/remote-runners.md) such as [Earthly Satellites](/earthly-0.7/earthly-cloud/satellites.md). Because Bitbucket Pipelines run as containers you can also use the official Earthly Docker image. Here is an example of a Bitbucket Pipeline build. This example assumes your Earthfile has a `+build` target defined.

```yml
# ./bitbucket-pipelines.yml

image: earthly/earthly:v0.7.23

pipelines:
  default:
    - step:
        name: "Set Earthly token"
        script:
          - export EARTHLY_TOKEN=$EARTHLY_TOKEN
          # See https://docs.earthly.dev/docs/earthly-command#earthly-account-create-token to obtain a token.
          - earthly --version
    - step:
        name: "Docker login"
        script:
          - docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"
    - step:
        name: "Build"
        script:
          - earthly --push --sat $EARTHLY_SAT --org $EARTHLY_ORG +build
```

For a complete guide on CI integration see the [CI integration guide](/earthly-0.7/ci-integration/overview.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.earthly.dev/earthly-0.7/ci-integration/vendor-specific-guides/bitbucket-pipelines-integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
