Hello Alejo Millo
Welcome to microsoft Q&A, Thankyou for posting your query here.
Your Dockerfile looks good for a .NET 8 app. You've opened up ports 8080 and 8081 the right way, just like how .NET 8 needs it.
Azure Container Instances (ACI) doesn't let you pick a specific "target port".
you can get your ports set up the way you need with the help of Azure's command-line tools.
Make sure you're signed into your Azure account with the command line tool by typing az login.
Then, you'll use the az container create
command to make your container with the right ports.
az container create \
--resource-group <RESOURCEGROUP NAME> \
--name <ContainerName> \
--image <Image> \
--dns-name-label <DnsName> \
--ports 8080 \
--environment-variables ASPNETCORE_URLS="http://+:8080" \
--protocol TCP
If, after setting everything up, you're still having trouble connecting (like getting "Connection reset" errors),:
Use Azure's website or the command line tool to check your container's logs for any errors during startup.
Check to make sure no network security settings or firewalls are blocking the ports you're using.
If you've just set up a friendly DNS name for your container, give it a bit of time to start working everywhere.
Hope this helps you.
If an answer has been helpful, please consider accepting the answer to help increase visibility of this question for other members of the Microsoft Q&A community. If not, please let us know what is still needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!