Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS ECS task healthcheck always failed

I made a task defination in AWS ECS as shown in screenshots:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Now when I run taskdefination in a cluster, it successfully run, but status of container remains unhealthy forever. And when I try same command(healthcheck command[curl command]) running inside container, I am able to run same command inside container, then it run successfully. I had also tried CMD instead of CMD-SHELL , but nothing working. Inside container apache is running at port 80.

Note I am making docker image by committing docker container not by Dockerfile.

Not getting why healthcheck is not working. Nothing significant found online. Please help if someone before had faced this issue.

like image 921
YATIN GUPTA Avatar asked Jun 19 '18 13:06

YATIN GUPTA


People also ask

Why does my ECS Task keep stopping?

Your Amazon ECS tasks might stop due to a variety of reasons. The most common reasons are: Essential container exited. Failed Elastic Load Balancing (ELB) health checks.

Why is ELB health check failing?

An instance might fail the ELB health check because an application running on the instance has issues that cause the load balancer to consider the instance out of service.

What will happen when an EC2 instance fails to pass health checks?

If an instance fails these status checks, it is marked unhealthy and is terminated while Amazon EC2 Auto Scaling launches a new replacement instance. You can attach one or more load balancer target groups, one or more Classic Load Balancers, or both to your Auto Scaling group.


1 Answers

You have made a mistake in command in HEALTHCHECK section (double pipe).

I suppose you want to use CMD-SHELL,curl --fail http://localhost/ || exit 1 instead of ...|exit 1|

like image 170
Václav Dobšíček Avatar answered Oct 05 '22 01:10

Václav Dobšíček