Example Flask and socket app running on 2 separate ports in a container image.
Includes code to deploy to Azure Container instance with public access.
Built and tested on Windows 11 installed with Windows Subsystem for Linux and Docker Desktop.
git clone https://github.com/tonyskidmore/azure-container-ports.git
cd azure-container-ports
docker build -t python-multiservice .
docker run -p 5000:5000 -p 5001:5001 python-multiservice
curl http://localhost:5000
curl telnet://localhost:5001 <<< "testing TCP connection"
az login
az group create \
--name rg-azure-container-ports \
--location uksouth
ip_address=$(az deployment group create \
--resource-group rg-azure-container-ports \
--template-file infra/aci.bicep \
--query "properties.outputs.containerIPv4Address.value" \
--output tsv)
Note: assumes that ports 5000/tcp and 5001/tcp are allowed outbound
curl http://${ip_address}:5000
curl telnet://${ip_address}:5001 <<< "testing TCP connection"
az group delete --name rg-azure-container-ports