Hi Atlassian Support,
I’m reaching out to understand whether there is a supported way to use Docker images hosted in Bitbucket Packages as base images within Bitbucket Pipelines without relying on personal API tokens.
Current situation:
Problem:
What we’re looking for:
If this is not currently supported, we would appreciate any guidance on:
This capability would significantly improve reliability and reduce maintenance effort for teams managing multiple repositories.
Thanks in advance for your help.
Kind regards
Hello,
I have a similar problem but it only fails when using repository access tokens from outside the pipeline.
I replied with more detail in this same post.
Hello and welcome to the Community @James Zhang
You should be a bit careful with the current reply in my opinion.
What Atlassian clearly documents today is that Bitbucket Packages uses crg.apkg.io, and that Pipelines has built-in package credentials through BITBUCKET_PACKAGES_USERNAME and BITBUCKET_PACKAGES_TOKEN.
What you do not really see documented is repository, project, or workspace access tokens as the standard auth method for Bitbucket Packages registry access. Atlassian documents those tokens for Bitbucket API and Git usage.
You shouldn't treat that token suggestion as confirmed. You are on firmer ground if you stick to the Packages auth methods Atlassian actually documents.
Can you clarify one point? do you need that image as the actual top-level pipeline image, or do you only need to pull it later inside the step? If it is the top-level build image, you would want Atlassian staff to confirm the supported auth path before you roll that out across hundreds of repos.....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Arkadiusz Wroblewski Thanks for the information. Yes I want the package image to be used in top level.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
before you roll this out across hundreds of repos, you should get this confirmed by Atlassian.
For your exact case, the open question is whether that token approach is really supported for the top-level pipeline image, not just for image pulls later in the step.
So I would not build around that yet. You should ask Atlassian to confirm the supported setup first.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @James Zhang
Welcome to the community!
This is a common pain point. The good news is there is a supported way to avoid personal API tokens for this — use Repository Access Tokens or Workspace Access Tokens, which are non-personal and can be rotated/managed independently.
Recommended solution
read:repository:bitbucket scope.DOCKER_TOKEN) in your repository or workspace settings.bitbucket-pipelines.yml, authenticate to the registry using the token:
image:
name: packages.atlassian.net/your-image:tag
username: x-token-auth
password: $DOCKER_TOKEN
This avoids personal tokens entirely. Workspace-level tokens are the best option for hundreds of repos since one token can be used across all of them via a workspace-level pipeline variable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have a Bitbucket Pipeline in my repository that successfully builds a Docker image and pushes it to the Bitbucket Container Registry.
I can pull the image from my laptop using a Personal API Token with the read:package:bitbucket scope, so the registry itself is working correctly. However, I would prefer not to use my personal token for this use case.
To avoid that, I created a Repository Access Token. The available scopes only seem to include read:repository (I could not find any package/container registry related scope), but authentication always fails when I try to pull the image using this token.
I also tried authenticating with both:
x-token-auth
<repo-uuid>@bots.bitbucket.org
for docker login, based on your suggestion, but I still receive authorization errors.
Am I missing a required scope or configuration for pulling images from the Bitbucket Container Registry using Repository Access Tokens?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.