Skip to content
Latchkey

How to Use a Private Docker Image in Bitbucket Pipelines

An image block with username, password, and email lets a step pull a private image.

Expand the image key into an object with credentials sourced from secured variables. Bitbucket logs into the registry and pulls the private image for the step.

Authenticate to a private registry

Provide the image name plus credentials from secured variables.

bitbucket-pipelines.yml
pipelines:
  default:
    - step:
        name: Build
        image:
          name: my-registry.example.com/team/builder:latest
          username: $DOCKER_USER
          password: $DOCKER_PASS
        script:
          - make build

Notes

  • Store DOCKER_USER and DOCKER_PASS as secured repository or workspace variables.
  • For AWS ECR, use the aws-ecr specific image fields instead of username/password.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →