My bitbucket pipeline is now failing on my docker build and push to AWS step. Nothing has been changed here and the pipeline just started breaking. The error I am getting is:
"no basic auth credentials"
Any idea what is causing this? Here is the code for the step:
- step:
name: Build Docker Image
services:
- docker
image: atlassian/pipelines-awscli
script:
- echo $(aws ecr get-login --no-include-email --region $DEFAULT_REGION) > login.sh
- sh login.sh
- docker build -f Dockerfile-stage -t $SERVICE_NAME --build-arg NPM_TOKEN=${NPM_TOKEN} .
- docker tag $SERVICE_NAME:latest $ECR_URL/$SERVICE_NAME:latest
- docker push $ECR_URL/$SERVICE_NAME:latest
I'm not so fluent with it, what I noticed was that your pipeline script creates a login script first and then executes it. Have you considered to just execute the commands like:
script:
- $(aws ecr get-login --no-include-email --region $DEFAULT_REGION)
- docker build ...
?
Also keep in mind that it is necessary that the docker login / credentials the aws ecr get-login creates are addressable correctly (otherwise you get exactly the "no basic auth credentials" error).
That is the docker login (from aws ecr get-login ...) must be aligned with the $ECR_URL environment parameter (a.k.a. environment variable) in your example as otherwise the later docker push won't be able to make use of the earlier added credentials - they are added for a "different" docker registry and just don't match.
Therefore no credentials and the "no basic auth credentials" message (for docker push) clearly shows this.
Hi,
I saw the same error when my pipeline was not doing docker login. Is it possible that your script login.sh doesn't run docker login? Did you change environment variables?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Literally nothing has changed, which makes me thing it's an issue with Bitbucket Pipelines itself. It has been working great for months and just randomly started breaking.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Learn why Compass was built to tackle dev experience at scale. See how Atlassian uses it to boost visibility, reduce cognitive load, and drive consistency—plus tips to get started and customize your IDP for stronger team engagement.
Join the webinar ✨Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.