Perform the following steps:
- The first step is to ensure that we provide a valid tag to the image using the docker tag functionsindocker cookbookregistry.azurecr.io/functionsindocker:v1 command. Running this command won't provide any output. However, to view our changes, let's run the docker images command, as shown in the following screenshot:
- In order to push the image to ACR, you need to authenticate yourself to Azure. For this, you can use Azure CLI commands. Let's log in to Azure using the az login command. Running this command will open a browser and authenticate your credentials, as shown in the following screenshot:
- The next step is to authenticate yourself to the ACR using the az acr login --name cookbookregistry command. Replace the ACR name (in my case, it is cookbookregistry) with the one you have created:
- Once you authenticate yourself, you can push the image to ACR by running the docker push cookbookregistry.azurecr.io/functionsindocker:v1 command, as shown in the following screenshot:
- Let's navigate to ACR in the Azure portal and review if our image was pushed to it properly in the Repositories blade, as shown in the following screenshot:
We have successfully created an image and pushed it to ACR. Now, it's time to create the Azure Function, and refer the Docker image that was pushed to the ACR.