Hi, I have tried to solve this problem but have failed.
I need to build a docker image using bitbucket-pipelines and ACR.
I need examples of how to write the bitbucket-pipelines.yml
using 'az acr build' and how to push the image into ACR.
Please advise.
/Bo Christensen
Hi Bo,
Just to give you some context, Pipelines builds run in Docker containers. For every step of your build, a Docker container starts using the image you have specified in your bitbucket-pipelines.yml file. The repo is cloned in that container, and then the commands of the step's script are executed. When the step finishes that Docker container gets destroyed.
If you want to execute commands like 'az acr build', the Azure CLI needs to be installed on the Docker image that is specified as a build container in your bitbucket-pipelines.yml file. Microsoft provides the Docker image mcr.microsoft.com/azure-cli that has Azure CLI pre-installed. You can use it by specifying it in your bitbucket-pipelines.yml file as follows:
image: mcr.microsoft.com/azure-cli
This is the documentation for the Docker image options in bitbucket-pipelines.yml
If you use a different Docker image as a build container, you will need to install Azure CLI in the container by adding the necessary commands in the script of your step. So, it may be easier to use mcr.microsoft.com/azure-cli instead.
You should then be able to use commands from Azure CLI in the script of your step. For the exact commands that you need to use, you will need to check Azure CLI documentation:
If you have any questions, please feel free to reach out.
Kind regards,
Theodora
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.