Answers: <p>The ports directive in your docker-compose.yml ('5173:5173') usually specifies port mappings for local development and is often ignored by hosting environments like Azure App Service, which have their own mechanisms for routing and exposing ports.</p>
  <p>Your frontend code is served on port 443 because Azure App Service automatically handles the routing and SSL termination for your containerized applications, directing external HTTPS traffic to the internal port that your container exposes. This simplification is part of the managed service offering, allowing you to focus on the application development rather than the infrastructure configuration.</p>
  
Answers: CC BY-SA 4.0
Answers: 2024-03-07T16:27:17.060Z
Answers: 2024-03-07T16:27:17.060Z
Answers: geeky_girl
Body: <h2>Project Setup</h2>
  <ul>
  <li>My React app image is stored on Azure Container Registry (ACR), with a <code>Dockerfile</code> as below,</li>
  </ul>
  <pre class="lang-yml prettyprint-override"><code>FROM node:16.19.1-alpine
  WORKDIR /frontend
  COPY ./frontend/package*.json .
  RUN npm install
  COPY ./frontend .
  EXPOSE 5173
  CMD npm run dev
  </code></pre>
  <ul>
  <li>On Azure App Service, I configured a <code>docker-compose.yml</code> setup since there'll be multiple images needed to be deployed on this app service (e.g., backend service), the compose file as below,</li>
  </ul>
  <pre class="lang-yml prettyprint-override"><code>version: '3.8'
  
  services:
    fe:
      image: bugman195.azurecr.io/traddo-fe:latest
      build:
        context: .
        dockerfile: ./fe/Dockerfile
      ports:
        - '5173:5173' -&gt; This port config is where I'm confused
  </code></pre>
  <h2>My question:</h2>
  <p>Why is my frontend code being served on port <strong>443</strong> automatically? Shouldn't it be served on port <strong>5173</strong> as my <code>docker-compose.yml</code> configured?</p>
  <p>Is there some sort of load balancing mechanism automatically done by Azure to direct port 443 to my container's 5173 port?</p>
  
Tags: <docker><docker-compose><azure>
Title: Why Azure App Service auto serve my site on port 443?
UserDisplayName: Bugman Huang
ThreadText: # Why Azure App Service auto serve my site on port 443?
  
  (Asked by: username_0 on 2024-01-09)
  
  ## Project Setup
  
  * My React app image is stored on Azure Container Registry (ACR), with a `Dockerfile` as below,
  
  ```yml
  FROM node:16.19.1-alpine
  WORKDIR /frontend
  COPY ./frontend/package*.json .
  RUN npm install
  COPY ./frontend .
  EXPOSE 5173
  CMD npm run dev
  
  ```
  
  * On Azure App Service, I configured a `docker-compose.yml` setup since there'll be multiple images needed to be deployed on this app service (e.g., backend service), the compose file as below,
  
  ```yml
  version: '3.8'
  
  services:
    fe:
      image: bugman195.azurecr.io/traddo-fe:latest
      build:
        context: .
        dockerfile: ./fe/Dockerfile
      ports:
        - '5173:5173' -> This port config is where I'm confused
  
  ```
  
  ## My question:
  
  Why is my frontend code being served on port **443** automatically? Shouldn't it be served on port **5173** as my `docker-compose.yml` configured?
  
  Is there some sort of load balancing mechanism automatically done by Azure to direct port 443 to my container's 5173 port?
  
  **Tags:** docker, docker-compose, azure
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-03-07. Score: 0
  
  The ports directive in your docker-compose.yml ('5173:5173') usually specifies port mappings for local development and is often ignored by hosting environments like Azure App Service, which have their own mechanisms for routing and exposing ports.
  
  Your frontend code is served on port 443 because Azure App Service automatically handles the routing and SSL termination for your containerized applications, directing external HTTPS traffic to the internal port that your container exposes. This simplification is part of the managed service offering, allowing you to focus on the application development rather than the infrastructure configuration.
  
  
  ---
  
  