Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bitbucket pipeline failing on Docker Image Push

Eric Wein
Contributor
March 4, 2020 edited

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

 

2 answers

0 votes
ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2020 edited

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.

0 votes
Egor Kovetskiy
Contributor
March 4, 2020

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?

Eric Wein
Contributor
March 4, 2020

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. 

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, compass, developer experience, devex, platform engineering, internal developer platform, component catalog, atlassian learning, productivity tools, developer productivity, software architecture, compass webinar, engineering teams

Discover how Compass drives DevEx and productivity at Atlassian 🏃🏻‍♂️

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 ✨
AUG Leaders

Atlassian Community Events