0

Project Setup

  • My React app image is stored on Azure Container Registry (ACR), with a Dockerfile as below,
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,
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?

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.