[App Service] Container start server on port 8080 but app service not starting

Maxime Meriaux 20 Reputation points
2025-05-08T12:20:03.04+00:00

Hello,

I hope you're doing well.

I'm using a Linux App Service configured to run a Docker image stored in an Azure Container Registry. Here's the situation:

  • The image works perfectly when run locally.
  • The server listens on 0.0.0.0:8080 inside the container.
  • A health check route is available at localhost:8080/microservice/ping.
  • A health check is defined in the Dockerfile as follows:
      HEALTHCHECK --interval=5s --timeout=30s --start-period=10s --retries=3 CMD [ "curl", "-f", "http://localhost:8080/microservice/ping" ]
    

However, the App Service fails to start properly and keeps restarting the server in a loop. Here's an excerpt from the logs:

2025-05-08T10:03:16.7922800Z $ bun dist/app.js
2025-05-08T10:03:21.0032041Z Connected to Redis store
2025-05-08T10:03:22.1863981Z Connected to SMTP mailer
2025-05-08T10:03:22.2989161Z Connected to Auth database
2025-05-08T10:03:51.2077309Z Server is running on port 8080
2025-05-08T10:11:36.7681705Z error: script "start" was terminated by signal SIGTERM (Polite quit request)
2025-05-08T10:11:53.2786286Z $ bun dist/app.js
2025-05-08T10:11:56.7066869Z Connected to Redis store
2025-05-08T10:11:57.5810270Z Connected to SMTP mailer
2025-05-08T10:11:57.6512759Z Connected to Auth database
2025-05-08T10:12:49.4807312Z Server is running on port 8080
2025-05-08T10:20:12.7414067Z error: script "start" was terminated by signal SIGTERM (Polite quit request)
2025-05-08T10:20:56.6050532Z $ bun dist/app.js
2025-05-08T10:21:00.1741820Z Connected to Redis store
2025-05-08T10:21:01.7179624Z Connected to SMTP mailer
2025-05-08T10:21:02.1266103Z Connected to Auth database
2025-05-08T10:21:33.1947359Z Server is running on port 8080
2025-05-08T10:24:45.8931738Z error: script "start" was terminated by signal SIGTERM (Polite quit request)

Do you have any idea what might be causing this issue or any suggestions for debugging further?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,789 questions
{count} votes

Accepted answer
  1. Sampath 3,250 Reputation points Microsoft External Staff Moderator
    2025-05-14T14:50:28.4666667+00:00

    Hello @Maxime Meriaux

    Thank you for describing the issue so clearly. I'm glad to hear the problem has resolved and I appreciate your follow-up note. Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'm reposting your solution here so that you can accept the answer.

    Solution:

    The issue was not related to the App Service configuration, Dockerfile, or the server setup. The container was correctly listening on port 8080, and Azure was properly configured to expect it.

    The actual root cause was introduced after upgrading to Elysia 1.3.0 and integrating the Elysia CORS plugin. This plugin was returning an empty response, which caused Azure's health check to fail, triggering container restarts.

    As a workaround, the CORS plugin was removed, and CORS was handled directly through the App Service configuration instead. This resolved the issue. Note that this bug has been fixed in Elysia version 1.3.1.

    Please click Accept Answer and kindly click Yes so others experiencing a similar issue can benefit as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.