Skip to content

App Runner Service Fails to be in "Running" state despite having the correct port in the Dockerfile and container being up and running

0

App Runner event logs 06-16-2025 07:15:54 AM [AppRunner] Performing health check on protocol TCP [Port: '8000']. 06-16-2025 07:21:56 AM [AppRunner] Health check failed on protocol TCP [Port: '8000']. Check your configured port number. For more information, see the application logs. 06-16-2025 07:22:09 AM [AppRunner] Deployment with ID : 8d97018720fd4127a2c46b071dea9fd4 failed. Failure reason : Health check failed. Application logs 06-16-2025 07:16:14 AM INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) 06-16-2025 07:16:14 AM INFO: Started parent process [1]

Unfortunately no more logs are available. Not even X-Ray enablement is showing any logs. This is puzzling. All the checks mentioned in the previous answers are satisfied.

Please let me know if Dockerfile needs to be posted here to help me.

Thanks

asked a year ago153 views
1 Answer
0

Based on your logs, I can see that your App Runner service is failing during the health check phase, despite your application appearing to start correctly on port 8000. This is a common issue with App Runner services and there are a few potential causes to investigate.

The key issue here is that while your application is running on port 8000 (as shown in your application logs), the App Runner service is unable to successfully complete health checks on that port.

Here are some potential solutions:

  1. Port Configuration Mismatch: Ensure that the port you've configured in App Runner matches the port your application is actually using. In your case, your application is running on port 8000, so make sure App Runner is configured to use port 8000 as well.

  2. Health Check Endpoint: If you're using HTTP protocol for health checks (though your logs show TCP), make sure your application has a health check endpoint that returns a 200 status code. For many web frameworks, you might need to explicitly add a health check route (like '/health') that responds with a success status.

  3. Update Service Configuration: If your App Runner service is in a failed state, you can rebuild it with updated configuration. You can do this by:

  • Going to the App Runner console
  • Selecting your service
  • Making necessary configuration changes
  • Rebuilding the service
  1. Check Container Port Exposure: Make sure your Dockerfile properly exposes the port your application is using (EXPOSE 8000).

  2. Try Different Health Check Protocol: If you're currently using TCP, you might try switching to HTTP if your application supports it, or vice versa.

Since your application logs show that the service is running on port 8000 and App Runner is attempting health checks on the same port, the issue might be related to how your application is handling the health check requests or how the container is exposing the port.
Sources
Deploy https://gallery.ecr.aws/docker/library/httpd to apprunner failed | AWS re:Post
Service - AWS App Runner
Rebuilding a failed App Runner service - AWS App Runner
service basic-ml-microservice-service port 5000 is unhealthy in target-group ecs-mlewp2-basic-ml-microservice due to (reason Health checks failed with these codes: [404]). | AWS re:Post
AWS App Runner Health Check Fails Despite Successful Local Testing | AWS re:Post

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.