microsoft / azure-container-apps

Roadmap and issues for Azure Container Apps
MIT License
372 stars 29 forks source link

Is network alias supported in Azure Container Apps/Environment #1293

Open kamalsivalingam opened 1 month ago

kamalsivalingam commented 1 month ago

Please provide us with the following information:

This issue is a: (mark with an x)

Issue description

This is rather a question.. How do we implement network aliases within Azure Container Environment. While docker compose supports network aliases, if we feed the docker compose, does Azure Container Apps use the network alias?

For example, I have multiple azure container environments each of them having its own mongo db instances that needs to be referenced by name "mongo" by other container apps. i can not have the service name as mongo in every environment as Azure Container Environment is requiring the service names to be globally unique. How to achieve local dns resolution within azure container environment so that the name "mongo" resolves to the local instance within the container environment?

Steps to reproduce

  1. ..
  2. ..

Expected behavior [What you expected to happen.]

Actual behavior [What actually happened.]

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context

Ex. Did this issue occur in the CLI or the Portal?

v-vish commented 1 month ago

@kamalsivalingam Hi, Yes, if you have multiple Azure Container Environments, each with its own MongoDB instances, it's possible for other container apps to reference them by the name 'mongo'. -- In Azure Container Service (ACS), there is a feature called appname that functions similarly to Docker Composes network alias.

kamalsivalingam commented 1 month ago

Thanks @v-vish. If i have multiple container app environments, the name of the container app should be unique across all the environments. So do i have to suffix with something like environment name? Once i suffix and make the name unique, can i access the db container app from other container app using the name?

simonjj commented 1 month ago

You're application name does not have to be unique across all environments. You can use the same name over and over as long as it's not within the same environment. Are you wanting to connect from one environment to another one which hosts your DB?

kamalsivalingam commented 1 month ago

@simonjj Looks like the container app name should be unique across container environments not just within. I get below error when i try to use the same name in a different environment... (ContainerAppEnvironmentMismatch) Container App 'gw-pr-303' already exists in a different environment. To create it in the environment '/subscriptions/xxx-xxx-xxx/resourceGroups/xx-xx-xx/providers/Microsoft.App/managedEnvironments/pr-304' delete it from the environment 'pr-303' first.