Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Pipeline to push Docker Images to Azure ACR

Deleted user May 9, 2020

I am using the Bitbucket Pipelines instead of jenkins for ease purpose of development in our organization.

I need written a Dockerfile and placed it in the repo.

I also put a bitbucket pipeline for building the image and it was succeeded.

Now i need to push the created images to AZURE ACR instead of DockerHub, its asking for Dockerhub credentials for as default.

So how can i give my Azure ACR credentials to it.

Please help me in this regard.

Thankyou in advance.

 

2 answers

1 accepted

0 votes
Answer accepted
Radek Antoniuk
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.
May 10, 2020
Deleted user May 14, 2020

thankyou

Radek Antoniuk
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.
May 19, 2020

No problem! When you have resolved the problem, you could share a code snippet that works, for other people having the same problem.

Also, if any of the links above have helped, it would be good to mark the answer as "Accepted" so that others now where to look, thanks!

Like Gunnar Pedersen likes this
1 vote
Deleted user May 20, 2020

yes the links helped to solve the issue, i am sharing the snippet of code so it can be helpful for anyone looking for that.

 

image: atlassian/default-image:2

pipelines:
default:
- step:
services:
- docker
script: # Modify the commands below to build your repository.
# Set $DOCKER_HUB_USERNAME and $DOCKER_HUB_PASSWORD as environment variables in repository settings
- export IMAGE_NAME=<your ACR SERVER>/<DOCKER IMAGE>-api:latest

# build the Docker image (this will use the Dockerfile in the root of the repo)
- docker build -t $IMAGE_NAME .
# authenticate with the Docker Hub registry
- docker login  <your ACR server> --username <your ACR USERNAME> --password <your ACR PASSWORD>
# push the new Docker image to the Docker registry
- docker push $IMAGE_NAME

Oscar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 29, 2022

Appreciate you! 

Jamal Ashraf
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 24, 2022

Would you please explain that why you are login into docker as you are pushing your image into ACR? 
Secondly I would like to build an image which would be in my repositry(docker file) and then push it into ACR so it is kind of same scenario, please share a script if you have that? 

Maroline Johnson
Contributor
October 18, 2024

I am trying to do this for my implementation as well. Any help is appreciated! 

Karlis Vesters
Contributor
October 22, 2024

@Jamal Ashraf login is happening to ACR server you provide not docker hub.

Note that for larger images you will need to increase memory for the docker service by adding. More info here: Databases and service containers | Bitbucket Cloud | Atlassian Support

definitions:
  services:
     docker:
        memory: 2048

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events