Hello @David Dong,Welcome to microsoft Q&A,Thankyou for posting your query here. The error message "unable to detect docker environment" typically indicates that the Batch node is not configured to run Docker containers. To run Docker containers on a Batch node, you need to install Docker and configure the Batch node to use the Docker engine. You can do this by creating a custom image that includes the Docker engine and using that image as the base image for your Batch pool. Install Docker on the base image. You can do this by downloading the Docker installer and running it in silent mode.
FROM microsoft/dotnet-framework:4.7.2-sdk
# Download and install Docker
ADD https://download.docker.com/win/static/stable/x86_64/docker-18.09.3.zip C:\\docker.zip
RUN powershell -Command Expand-Archive -Path C:\\docker.zip -DestinationPath C:\\ ; \
Rename-Item -Path C:\\docker -NewName 'docker.exe' ; \
Move-Item -Path C:\\docker.exe -Destination C:\\Windows\\System32\\docker.exe
Build the custom image using the Docker command line
docker build -t <image-name> .
Use the custom image as the base image for your Batch pool.
When creating the pool, specify the custom image as the imageReference and set the node Agent SKU Id to batch.node.windows amd64.
az batch pool create \
--id mypool \
--vm-size Standard_D2_v2 \
--image-reference <image-name> \
--node-agent-sku-id "batch.node.windows amd64" \
--target-dedicated-nodes 1 \
--account-name mybatchaccount \
--account-endpoint https://mybatchaccount.region.batch.azure.com \
--access-key mybatchaccountkey
Hope this helps you. please consider accepting the answer to help increase visibility of this question for other members of the Microsoft Q&A community. If not, please let us know what is still needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!.