Skip to content

1 FAQ: Create Azure Container Instance with multiple ports

Yuwei Zhou edited this page May 13, 2019 · 1 revision

Sample issue: ansible/ansible#54139

In the azure_rm_containerinstance module, port specify the ports of public ip, it should be used when ip_address set to public. The port also should be set in every entry of containers.

NOTE If the Ansible version < 2.8.0, the sum (array level) of ports in the containers, MUST be equal to the ports option. E.G.

  - name: Create sample container group
    azure_rm_containerinstance:
      resource_group: myResourceGroup
      name: mynewcontainergroup
      os_type: linux
      ip_address: public
      ports:
        - 80
        - 81
      containers:
        - name: mycontainer1
          image: httpd
          memory: 1.5
          ports:
            - 80
            - 81

From Ansible 2.8.0, the ports option becomes useless. User can focus on the ports in containers. E.G.

  - name: Create sample container group
    azure_rm_containerinstance:
      resource_group: myResourceGroup
      name: mynewcontainergroup
      os_type: linux
      ip_address: public
      containers:
        - name: mycontainer1
          image: httpd
          memory: 1.5
          ports:
            - 80