[BUG] error deploying docker image without existing container registry
Describe the bug All the required packages (recommended versions) are installed and deploy.parameters.json have been filled in with the required variable values. I did not create a container registry beforehand as it was not marked as a required variable.
However, it throws an error - "Deploying docker image 'graphrag:backend' to container registry 'xxxx.azurecr.io'...Error deploying docker image, exiting.." I have reproduced this bug both on Windows as well as WSL.
To Reproduce Steps to reproduce the behavior:
- Install all the required packages in Windows/WSL
- Fill in all the required values in infra/deploy.parameters.json
- Run the command "bash deploy.sh -p deploy.parameters.json"
- See error "Deploying docker image 'graphrag:backend' to container registry 'xxxx.azurecr.io'...Error deploying docker image, exiting.."
Expected behavior Deployment should automatically complete successfully.
Screenshots
Desktop (please complete the following information):
- OS: Windows & WSL
- Version 23H2
Additional context I already had AOAI resources which I have filled in. I however didn't find any instruction about setting up cognitive services resources, so I didn't provide them anywhere.
I have encountered the same problem using github codespaces.
Please check below instruction:
@rnpramasamyai I already have these permissions- I am an owner of the subscription. It also works when I deploy from the devcontainer using the docker option. So access issues do not seem to be the reason for this failure.
@satarupaguha11 if you update https://github.com/Azure-Samples/graphrag-accelerator/blob/c211508a7d569ea71f831a171cc5cbd832c69264/infra/deploy.sh#L533 and remove > /dev/null 2>&1 from the end of the line, and run again, you should get more logging output to go on.
Add resource group to both az acr show and az acr build command. When resource group is not included, existing ACR will not be found.
createAcrIfNotExists() {
# check if container registry exists
printf "Checking if container registry exists... "
local existingRegistry
existingRegistry=$(az acr show --name $CONTAINER_REGISTRY_SERVER --resource-group $RESOURCE_GROUP --query loginServer -o tsv 2>/dev/null)
if [ $? -eq 0 ]; then
printf "Yes.\nUsing existing registry '$existingRegistry'.\n"
CONTAINER_REGISTRY_SERVER=$existingRegistry
return 0
fi
# else deploy a new container registry
printf "No.\nCreating container registry... "
AZURE_ACR_DEPLOY_RESULT=$(az deployment group create --resource-group $RESOURCE_GROUP --name "acr-deployment" --template-file core/acr/acr.bicep --only-show-errors --no-prompt -o json
--parameters "name=$CONTAINER_REGISTRY_SERVER")
exitIfCommandFailed $? "Error creating container registry, exiting..."
CONTAINER_REGISTRY_SERVER=$(jq -r .properties.outputs.loginServer.value <<< $AZURE_ACR_DEPLOY_RESULT)
exitIfValueEmpty "$CONTAINER_REGISTRY_SERVER" "Unable to parse container registry login server from deployment, exiting..."
printf "'$CONTAINER_REGISTRY_SERVER' created.\n"
}
deployDockerImageToACR() { printf "Deploying docker image '${GRAPHRAG_IMAGE}' to container registry '${CONTAINER_REGISTRY_SERVER}'..." local SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; #az acr build --registry $CONTAINER_REGISTRY_SERVER -f $SCRIPT_DIR/../docker/Dockerfile-backend --image $GRAPHRAG_IMAGE $SCRIPT_DIR/../ > /dev/null 2>&1 az acr build --registry $CONTAINER_REGISTRY_SERVER --resource-group $RESOURCE_GROUP -f $SCRIPT_DIR/../docker/Dockerfile-backend --image $GRAPHRAG_IMAGE $SCRIPT_DIR/../ > /dev/null 2>&1 exitIfCommandFailed $? "Error deploying docker image, exiting..." printf " Done.\n" }
@satarupaguha11 Please update your Linux subsystem if you are using Linux on Windows. It solved many issues when I tried to deploy this repo.