'Setting URL of ECS container health check

I have a docker image I want to run on AWS ECS. This is a API I want to use from other applications. I have set up the task definition, however it runs for a few minutes and then shuts down due to unhealthy status checks.

My API has an endpoint /healthy which I am using for health checks. On the page where I create a task definition I have entered the details as follows:

enter image description here

However, this is running into issues every few minutes as the health check will return unhealthy status and the container will fail. This affects my other applications as they depend on the container to provide services. This is weird to me as when I take the public IP of the task and go to that url/health it returns a healthy status.

Can anyone help me with setting the correct command for this?



Solution 1:[1]

These are Docker level checks, not your load balancer checks. For container level checks, you should provide full command used for this check, e.g.:

curl -sS http://127.0.0.1/health || exit 1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcin