Specify a port range when creating a container instance

David Griffith 6 Reputation points
2021-04-15T23:59:28.24+00:00

How can I specify a port range when creating a container instance? There is an option to add up to 5 ports but it only takes an array of integers. How can I expose ports 49152-65535?

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
455 questions
1 vote

2 answers

Sort by: Most helpful
  1. SUNOJ KUMAR YELURU 12,396 Reputation points Microsoft MVP
    2021-04-16T01:41:56.203+00:00

    Hi @David Griffith

    Refer to the below url it is explained expose multiple port on azure container instance.
    https://stackoverflow.com/questions/45596544/how-to-expose-multiple-ports-on-azure-container-instance

    If the Answer is helpful, please click Accept Answer and up-vote, this can be beneficial to other community members.

    No comments

  2. Stan-19835 21 Reputation points
    2021-12-01T10:16:43.507+00:00

    Hi,
    I know this question is answered a long time ago, but I found this as the first hit on Google. So I thought to answer it still anyway.

    Unfortunately it doesn't look like it's possible to open a port range in the traditional way. The documentation states: (for the az command).

    --ports
    A list of ports to open. Space-separated list of ports.
    default value: [80]

    And for the yml reference

    Port object
    PORT OBJECT
    Name Type Required Value
    protocol enum No The protocol associated with the port. - TCP or UDP
    port integer Yes The port number.

    Conclusion. It doesn't look like it's possible and you'll just have to paste in the ports manually into your yml file or az command.

    No comments