I'm struggling with Azure Container Registry performance. For some reason pulling images from docker hub is faster than using ACR even though the container and ACR are both located inside 'East US' datacenter
string containerImage = "**.azurecr.io/****";
containerGroup = azure.ContainerGroups.Define(this.containerGroupName)
.WithRegion(azureRegion)
.WithExistingResourceGroup(resourceGroupName)
.WithLinux()
.WithPrivateImageRegistry("***.azurecr.io", "ACR-username", "ACR-password")
.WithoutVolume()
.DefineContainerInstance(containerInstanceName)
.WithImage(containerImage)
.WithoutPorts()
.WithCpuCoreCount(currentCpu)
.WithMemorySizeInGB(currentRam)
.WithStartingCommandLine("/bin/sh", "-c", commandLine)
.Attach()
.WithRestartPolicy(ContainerGroupRestartPolicy.Never)
.WithLogAnalytics(workspaceId, workspaceKey)
.Create();
When using Docker hub I used a public image with the exact same dockerfile. The only code that changes is shown below.
string containerImage = "registry.hub.docker.com/****";
...
.WithPublicImageRegistryOnly()
...
For some reason when using ACR registry the container remains in 'Pending' state far longer than when using docker registry.
Can anyone point out where I'm going wrong? Why is ACR taking longer than docker? ACR should be a lot faster as both the registry and container are in the same datacenter.
EDIT: Just some stats on the differences: 700MB container
ACR - startup times
- Container startup time 158.0362116 seconds
- Container startup time 1003.6491133 seconds
- Container startup time 67.585987 seconds
- Container startup time 912.319042 seconds
Docker registry - startup times
- Container startup time 98.0485261 seconds
- Container startup time 278.4380892 seconds
- Container startup time 97.0235342 seconds
- Container startup time 307.8993358 seconds