dockerized webapp not publicly accessible from azure VM ubuntu

Spencer Trinh 26 Reputation points
2021-01-07T00:27:09.643+00:00

Hi,

I have opened ports on the Azure portal as well as inside the vm but I'm still not able to access the webapp which works locally on my laptop. I tried the following suggestions:

1) opening ports within the VM: bl1adv_firewallportopenexamples.htm

2) setting inbound rules in Azure portal: windows-azure-virtual-machine-opening-a-port

Here is the output of the docker-compose up command

Starting OpenBSD Secure Shell server: sshd.
pyapi       | [2021-01-06 16:19:36 -0800] [1] [INFO] Starting gunicorn 20.0.4
pyapi       | [2021-01-06 16:19:36 -0800] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
pyapi       | [2021-01-06 16:19:36 -0800] [1] [INFO] Using worker: sync
pyapi       | [2021-01-06 16:19:36 -0800] [8] [INFO] Booting worker with pid: 8

When I type in my browser: {PUBLIC_VM_IP}:5000 I get a, 'cannot be reached' error. But my webapp still does not show up. Please provide assistance. Thanks

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,158 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,909 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Spencer Trinh 26 Reputation points
    2021-01-12T04:38:42.997+00:00

    hi ryan, thanks for your responses. I got it working. Not sure what I did, but I just added an nginx reverse proxy in the front and forwarded port 1337-> 5000 and was able to access the website publicly.

    1 person found this answer helpful.
    0 comments No comments

  2. Ryan Hill 25,981 Reputation points Microsoft Employee
    2021-01-07T16:11:52.907+00:00

    If I'm understanding correctly @Spencer Trinh , you have an Ubuntu VM that's running docker image that contains your python web app. Rather than accessing on port 5000, your docker-compose should bind 5000 to 80 ports: - 5000:80 so the VM can route traffic on 80 to your docker web app.

    Regards,
    Ryan