Docker Desktop
We can deploy Data API Builder (DAB) using Docker Compose in Docker Desktop. An example compose file:
version: '3'
services:
DAB-AutoGen:
image: "mcr.microsoft.com/azure-databases/data-api-builder:latest"
container_name: DAB-AutoGen
ports:
- "5002:5000"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- c:\DataAPIBuilder\Samples\:/App/DAB-Configs
command: ["--ConfigFileName", "/App/DAB-Configs/dab-config-AutoGen.json"]
DAB-AutoGen2:
image: "mcr.microsoft.com/azure-databases/data-api-builder:latest"
container_name: DAB-AutoGen2
ports:
- "5003:5000"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- c:\DataAPIBuilder\Samples\dab-config-AutoGen.json:/App/dab-config.json
Azure Container Instance
We can also deploy the container in Azure Container Instance (ACI). The DAB configuration files need to be store in Azure File Share.
az container create
--resource-group rg_api \
--name dab-autogen \
--image mcr.microsoft.com/azure-databases/data-api-builder:latest \
--ip-address public \
--ports 5000 \
--cpu 1 \
--memory 2 \
--os-type Linux \
--azure-file-volume-account-name <your storage account name> \
--azure-file-volume-account-key <your storage account key> \
--azure-file-volume-share-name <your Azure file share name> \
--azure-file-volume-mount-path /DAB-Configs \
--command-line "dotnet Azure.DataApiBuilder.Service.dll --ConfigFileName /DAB-Configs/dab-config-AutoGen.json" \
--restart-policy never \
-o json
Docker Compose file for ACI. Pay attention to the difference with command parameters between compose file for ACI and Docker Desktop above.
version: '3'
services:
DAB_Test:
image: "mcr.microsoft.com/azure-databases/data-api-builder:latest"
container_name: DAB_Test
ports:
- "5001:5000"
volumes:
- configfilevolume:/App/DAB-Configs
command: "dotnet Azure.DataApiBuilder.Service.dll --ConfigFileName /DAB-Configs/dab-config.json"
DAB-AutoGen:
image: "mcr.microsoft.com/azure-databases/data-api-builder:latest"
container_name: DAB-AutoGen
ports:
- "5002:5000"
volumes:
- configfilevolume:/App/DAB-Configs
command: "dotnet Azure.DataApiBuilder.Service.dll --ConfigFileName /DAB-Configs/dab-config-AutoGen.json"
volumes:
configfilevolume:
driver: azure_file
driver_opts:
share_name: <file share name>
storage_account_name: <your storage account name>
storage_account_key: <your storage account key>
az container create --name testcontainers --resource-group rg_api --file compose_DAB_aci.yaml --restart-policy never --ip-address public --cpu 1 --memory 2
Proper filewall setting required on the SQL Server to allow incoming traffic from the Docker Container or ACI. UDP 1434 (for SQL Browser Service) or specific SQL TCP port numbers if browser service is not enabled.
If SQL instance is in Azure VM, the firewall needs to be configured on both the Azure network for the VM and the Windows firewall inside the VM.