Hello lili zhang,
Thanks for sharing the details on your az acr build error while working through the AKS Fabrikam Drone Delivery reference implementation (part 9, workload.md)—that's a solid hands-on lab for learning Azure Container Registry (ACR) and Kubernetes deployments, and path resolution issues like "./src/shipping/delivery/." not existing are super common when running CLI commands from the wrong context or with incomplete repo setups. As a Microsoft Certified Trainer with Azure AI and DevOps experience, I've guided many through this exact sample, and the error typically boils down to the current working directory, missing cloned files, or a subtle syntax quirk in the command. I'll explain why it's failing and how to debug/fix it step by step, drawing from the updated AKS docs and CLI behaviors as of October 2025.
Understanding the Error
The message "./src/shipping/delivery/. does not exist" means the Azure CLI can't locate the build context path when pushing your Dockerfile and source to ACR. In az acr build, the final argument specifies the local directory to use as the build root (containing the Dockerfile and app files)—it resolves relative to your current shell location. If you're running the command from the repo's root (e.g., /path/to/aks-fabrikam-dronedelivery), ./src/shipping/delivery/. should point to the delivery service's folder, but the trailing "." might confuse the parser or indicate a deeper issue like:
- Wrong Directory: You're not in the cloned repo root, so
./src/... 404s.
- Incomplete Clone: Git didn't pull all submodules or files (the repo has multiple services like shipping/delivery).
- Path Syntax: The trailing "." is valid (it includes the current dir), but if the folder lacks a Dockerfile, ACR skips with this error.
- Permissions/Environment: Running in a restricted shell (e.g., Azure Cloud Shell without mounted storage) or with case-sensitive path mismatches on Linux.
From recent GitHub issues on the AKS samples repo (updated September 2025), this pops up if the git clone missed branches or if users skip the cd into the project folder. It's not an ACR bug but a local setup hiccup—ACR itself is healthy per Azure Status.
Step-by-Step Debugging and Resolution
Let's verify your setup and rebuild successfully. Assume you're on a Linux/macOS terminal or Azure CLI (v2.60+); adjust for Windows PowerShell.
- Check Your Current Location and Repo Structure:
- Run
pwd (or cd on Windows) to confirm you're in the cloned repo root, e.g., /home/user/aks-fabrikam-dronedelivery.
- List the directory:
ls -la (or dir on Windows). You should see folders like src/, docs/, and README.md.
- Drill down:
ls src/shipping/—it should show delivery/ with contents like Dockerfile, src/, and tests/.
- If
src/shipping/delivery/ is missing or empty:
- Re-clone the repo:
rm -rf aks-fabrikam-dronedelivery && git clone https://github.com/Azure-Samples/aks-fabrikam-dronedelivery.git && cd aks-fabrikam-dronedelivery.
- Pull latest:
git checkout main && git pull origin main. The sample uses the main branch; avoid master if outdated.
- Verify submodules (if any):
git submodule update --init --recursive.
- Navigate and Validate the Build Path:
- Change to the repo root:
cd aks-fabrikam-dronedelivery (or wherever you cloned it).
- Inspect the target:
ls -la src/shipping/delivery/. Key files needed:
-
Dockerfile (builds the .NET Core delivery service).
- App source in
src/shipping/delivery/src/.
- If missing, the path is invalid—double-check the lab instructions in
workload.md for the exact service (it's under shipping for delivery logic).
- Test path resolution:
realpath ./src/shipping/delivery/. (or echo $PWD/src/shipping/delivery/. on Windows). This should output a full path like /home/user/aks-fabrikam-dronedelivery/src/shipping/delivery/..
- Pro Tip: If using Azure Cloud Shell, mount your repo via Git or VS Code extension to avoid path issues.
- Run the Build with Verbose Logging:
- Common Fixes if It Persists:
- Path Adjustment: The lab might have updated—check
workload.md for the exact command. If the delivery service is in a different spot (e.g., ./src/services/delivery/), update accordingly. Browse the GitHub repo online to confirm: https://github.com/Azure-Samples/aks-fabrikam-dronedelivery/tree/main/src/shipping/delivery.
- Dockerfile Issues: Ensure
Dockerfile exists and is valid (no syntax errors). Test locally: cd src/shipping/delivery && docker build -t test-delivery .—if it fails, fix the Dockerfile (common: wrong base image or COPY paths).
- ACR Permissions: Run
az acr show --name $ACR_NAME --query "loginServer" to confirm setup. For AKS integration, ensure your ACR is attached: az aks update -n yourakscluster -g yourrg --attach-acr $ACR_NAME.
- CLI Version/Env: Update CLI:
az upgrade. If on Windows, use Git Bash for Unix-like paths. For macOS, ensure Docker Desktop is running (ACR build uses local Docker daemon).
- Alternative Build: Use
az acr build --file Dockerfile -r $ACR_NAME ./src/shipping/delivery to specify the Dockerfile explicitly.
- Debugging Tools for Deeper Insight:
- ACR Tasks Logs: After a failed build, query:
az acr build show -r $ACR_NAME -t delivery:0.1.0 --output table. Or use portal: ACR > Services > Build logs to view runs.
- Local Docker Test: Mimic ACR:
docker build -t local/delivery:0.1.0 ./src/shipping/delivery/.—pushes errors to stdout.
- Environment Vars: Echo vars:
echo "Current dir: $(pwd), Path exists: $([ -d ./src/shipping/delivery ] && echo yes || echo no)".
- If in a pipeline (e.g., Azure DevOps), check agent logs for checkout steps.
Next Steps in the Lab
Once built, proceed to deploy: kubectl apply -f ./aks-deployment.yaml (or similar in workload.md), then verify with az acr repository show-tags -n $ACR_NAME -r delivery --orderby time_desc. The full AKS-Fabrikam sample teaches CI/CD with ACR, so nailing the build unblocks Kubernetes manifests for the drone delivery backend.
This should get your image building and pushed—it's usually a quick path tweak. If you share your current pwd output, the exact error screenshot details, or the repo branch you're on, I can pinpoint it further. Keep at it; these labs are gold for AKS cert prep!
Best Regards,
Jerald Felix