As per the documentation you referenced:
Outbound public IP Used as the "from" IP for outbound connections that leave the virtual network. These connections aren't routed down a VPN. Outbound IPs aren't guaranteed and may change over time. Using a NAT gateway or other proxy for outbound traffic from a Container App environment is only supported on the workload profile environment.
So you need to attach a workload profile to your app with custom vNET configuration:
https://learn.microsoft.com/en-us/azure/container-apps/workload-profiles-manage-cli?pivots=aca-vnet-custom&tabs=external-env
After that, i suppose you can launch your NAT Gateway in that vnet:
https://learn.microsoft.com/en-us/azure/container-instances/container-instances-nat-gateway#deploy-a-nat-gateway-into-a-virtual-network
So the steps would be:
Create vNET
az network vnet create \
--address-prefixes 13.0.0.0/23 \
--resource-group "<RESOURCE_GROUP>" \
--location "<LOCATION>" \
--name "<VNET_NAME>"
Create a subnet
az network vnet subnet create \
--address-prefixes 13.0.0.0/23 \
--delegations Microsoft.App/environments \
--name "<SUBNET_NAME>" \
--resource-group "<RESOURCE_GROUP>" \
--vnet-name "<VNET_NAME>" \
--query "id"
Create the container app environment:
az containerapp env create \
--enable-workload-profiles \
--resource-group "<RESOURCE_GROUP>" \
--name "<NAME>" \
--location "<LOCATION>"
Create the container app with the previous env
az containerapp create \
--resource-group "<RESOURCE_GROUP>" \
--name "<CONTAINER_APP_NAME>" \
--target-port 80 \
--ingress external \
--image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest \
--environment "<ENVIRONMENT_NAME>" \
--workload-profile-name "Consumption"
Create a PublicIP
az network public-ip create \
--name myPublicIP \
--resource-group $resourceGroup \
--sku standard \
--zone 1 \
--allocation static
Deploy a NAT with that IP
az network nat gateway create \
--resource-group $resourceGroup \
--name myNATgateway \
--public-ip-addresses myPublicIP \
--idle-timeout 10
Configure the NAT for the subnet
az network vnet subnet update \
--resource-group $resourceGroup \
--vnet-name "<VNET_NAME>" \
--name "<SUBNET_NAME>" \
--nat-gateway myNATgateway
I haven't tested all the steps, but this should be the gist of it.