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 buildNotes
- 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
How to Deploy to AWS in Bitbucket PipelinesDeploy to AWS from Bitbucket Pipelines by configuring AWS credentials as secured repository variables and run…
How to Run a Step with a Larger Size in Bitbucket PipelinesGive a memory-hungry Bitbucket Pipelines step more resources by setting size: 2x or higher so heavy builds ge…