Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to expose web app for container on two different ports in azure?

Tags:

docker

azure

Our web app runs on two ports azure web app exposes port 80 by default which we have used for part 1 but for part two we need another port how can we expose it?

Our web app runs perfectly on local.

Our web app runs perfectly on container instance on two ports (there is an option in Azure for multiple ports while creating the container instance).

Update:

I contacted the Azure support team for this and they replied:

" Web App for Containers currently allows you to expose only one port to the outside world. That means that your container can only listen for HTTP requests on a single port. Some apps need multiple ports. For example, you might have one port that is used for requests into the app and a separate port that is used for a dashboard or admin portal. As of today, that configuration isn't possible in Web App for Containers.

We will attempt to detect which port to bind to your container, but you can also use the WEBSITES_PORT app setting and configure it with a value for the port you want to bind to your container.

So, I'm sorry but you cannot use 2 ports for the same web app."

like image 452
Kulshreshth K Avatar asked Jul 10 '19 15:07

Kulshreshth K


People also ask

Can a Docker container expose multiple ports?

In your Dockerfile , you can use the verb EXPOSE to expose multiple ports.

How are Azure Web Apps for containers fully managed?

Just pull container images from Docker Hub or a private Azure Container Registry, and Web App for Containers will deploy the containerized app with your preferred dependencies to production in seconds. The platform automatically takes care of OS patching, capacity provisioning, and load balancing.

How do you map a port on a container?

Map TCP port 80 in the container to port 8080 on the Docker host for connections to host IP 192.168. 1.100. Map UDP port 80 in the container to port 8080 on the Docker host. Map TCP port 80 in the container to TCP port 8080 on the Docker host, and map UDP port 80 in the container to UDP port 8080 on the Docker host.


1 Answers

For your issue, you should know there are differences between Azure Web App and Azure Container Instance.

In Azure Web App, you just can use only two ports: 80 and 443. And they are exposed in default. You just need to listen to one of them or both in the container. But in Azure Container Instance, you can expose all the ports that you use in the container as you wish.

So for Web app for Container, if the two ports are not 80 and 443, then you cannot expose them.

like image 55
Charles Xu Avatar answered Nov 15 '22 06:11

Charles Xu