Error trying to create a new container in existing container instance using yaml file

HughA 0 Reputation points
2024-06-17T09:31:36.54+00:00

I'm trying to create a new container in an existing container instance (I assume you can have several containers in a container instance), but I get this error message:

(InvalidResourceLocation) The resource 'test-app' already exists in location 'australiasoutheast' in resource group 'algo_trading'. A resource with the same name cannot be created in location 'australiaeast'. Please select a new resource name.

Code: InvalidResourceLocation

Message: The resource 'test-app' already exists in location 'australiasoutheast' in resource group 'algo_trading'. A resource with the same name cannot be created in location 'australiaeast'. Please select a new resource name.

The image test-image exists in ACR, the existing container instance is called test-app.

This is the yaml file and I try to create the container using the command:

az container create --resource-group <resource_group> --file docker_compose_test_app.yaml
name: test-app # Name of the existing container group
apiVersion: '2021-10-01'
location: australiaeast
properties:
  containers:
  - name: test-cont  # name of the new container
    properties:
      image: test_image  # container image in acr used to create the instance
      resources:
        requests:
          cpu: 1
          memoryInGb: 1.5
      ports:
      - port: 5000
  osType: Linux
  ipAddress:
    type: Public
    ports:
    - protocol: tcp
      port: 5000
tags: {exampleTag: tutorial}
Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
460 questions
Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
708 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. akinbade abiola 17,210 Reputation points
    2024-06-17T10:18:28.74+00:00

    Hello HughA,

    Thanks for your question

    It doesn't allow creating a new container group named "test-app" because a resource with that name already exists in "australiasoutheast."

    The simplest solution is to modify your YAML file and choose a unique name for the new container group. This name shouldn't conflict with existing resources.

    Regards,

    You can mark it 'Accept Answer' if this helped you


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.