I have a container instance and a virtual machine (linux) in the same vnet on Azure. The container is a web service. The virtual machine also has a public IP address. How can I route all traffic to the virtual machine in a specific port(example: 8080) to the container (so I can public my web service) ?
Asked
Active
Viewed 279 times
0

Karishma Tiwari - MSFT
- 1,455
- 9
- 16

ktcl
- 365
- 6
- 23
-
What do you want? Access the ACI that in the Vnet from the Internet? – Charles Xu Aug 01 '19 at 06:26
-
Yes. I want to access that web service by public IP address of virtual machine. – ktcl Aug 01 '19 at 06:42
-
Why from the public virtual machine? It's an exact requirement or just needs the public IP? – Charles Xu Aug 01 '19 at 06:44
-
I just need the public IP, but the container already joined a virtual network, so it cannot be assigned a public IP address – ktcl Aug 01 '19 at 07:49
-
OK, it's clear. You need to access the ACI through the Internet, but the ACI is created in a vnet. – Charles Xu Aug 01 '19 at 07:51
-
Yes, I tried nginx on virtual machine as a reverse proxy, but it doesn't work – ktcl Aug 01 '19 at 08:01
1 Answers
0
To access the Azure Container Instance that created in the Vnet, I will suggest the Azure Application Gateway. You can create an Azure Application Gateway as the front end with the public IP, and use it to redirect the traffic to the ACI which in the Vnet. Then create a backend for the application gateway to the ACI private IP.
The application gateway backend pool would like this:

Charles Xu
- 29,862
- 2
- 22
- 39
-
I tried and it works even it's pretty complicated. I also figure out why my nginx on the virtual machine doesn't work, that's because the SELinux. Turn it off and we can use nginx as a reverse proxy. Thank you very much. – ktcl Aug 02 '19 at 03:36