When using docker compose to deploy a container group to Azure Container Instances, the --location argument specified when creating the docker context for aci, docker context create aci..., appears to have no effect.
I'm following these azure instructions for using docker compose with azure container instances
and this docker documentation showing the additional arguments for the docker context create command
Steps to re-produce
Pre-requisites:
Azure CLI
λ az version
{
"azure-cli": "2.22.1",
"azure-cli-core": "2.22.1",
"azure-cli-telemetry": "1.0.6",
"extensions": {}
}
Docker
λ docker-compose --version
docker-compose version 1.29.0, build 07737305
Docker Compose
λ docker --version
Docker version 20.10.5, build 55c4c88
Steps:
- Log into azure via the cli
az login - Authenticate docker with azure
docker login azure - Create an azure resource group in a specific location
az group create -l uksouth -n test-aci-ctx-group - Create a docker context specifying a location different to the resource group location
docker context create aci aci-context-eastus --resource-group test-aci-ctx-group --location eastus - Display the information about the new context.
docker context inspect aci-context-eastus - Expected result: a context bound to the location specified as
--locationfor thedocker context createcommand, i.e., eastus - Actual result: a context bound to the same location as the azure resource group, i.e., uksouth
λ docker context inspect aci-context-eastus
[
{
"Name": "aci-context-eastus",
"Metadata": {
"Description": "test-aci-ctx-group@uksouth",
"Type": "aci"
},
"Endpoints": {
"aci": {
"Location": "uksouth",
"ResourceGroup": "test-aci-ctx-group",
"SubscriptionID": "xxxxxxxxxxxxxxxxxxx"
},
"docker": {
"SkipTLSVerify": false
}
},
"TLSMaterial": {},
"Storage": {
"MetadataPath": "xxxx",
"TLSPath": "xxxx"
}
}
]
The ultimate manifestation of this issue is that I am unable to create a container group in azure because I'm working in the context of a resource group which I cannot change, but the resource group is in a location that does not support Azure Container Instances.
When I try and issue the docker-compose up command in the aci context that I thought I created in a location that supports azure container instances, I get a location not supported error, listing the location of the resource group and not the location I specified for the docker aci context.
Am I misunderstanding the purpose of the --location parameter?
I know you can mix and match locations between a container instance and a resource group because I am able to create a container instance via azure cli with a location different to that of the resource group that it is linked to.