Thank you for reaching out to the Microsoft Q&A platform.
To open a port in a container instance, you can use the EXPOSE
directive in your Dockerfile. The EXPOSE
directive specifies the ports that the container listens on.
Here is an example of how to open port 80 in a Dockerfile:
EXPOSE 80
You can then run the container with the desired port mapping using the -p
option with the docker run
command. For example, to map port 80 on the host to port 80 in the container, you would run the following command:
docker run -p 80:80 <image_name>
You can also configure the port mapping in the Azure Container Instance deployment. For more information, see the article "Quickstart - Deploy Docker container to container instance - Docker CLI
https://learn.microsoft.com/en-us/azure/container-instances/quickstart-docker-cli#main
Following docker run
command is an example to create the Azure container instance with port 80 exposed to the internet:
docker run -p 80:80 mcr.microsoft.com/azuredocs/aci-helloworld
Let me know if you have any further queries.
Please accept as answer and upvote if the above information is helpful for the benefit of the community.