Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not get docker healtcheck to work with ECS Fargate v 1.4.0

I have a health check defined for my ECS Fargate Service, it works when I test locally and works with Fargate v 1.3.0.

But when I change to Fargate Platform version 1.4.0 it always turns unhealthy. But the actual service is working. I can access the service on the containers public IP.

The health check is defined as:

"CMD-SHELL", "curl --fail http://localhost || exit 1"
like image 700
Hmazter Avatar asked Apr 15 '20 06:04

Hmazter


1 Answers

So we looked into this and there's an issue in platform version 1.4 where, if the health check outputs anything to stderr a false negative occurs. We will, obviously, fix this but in the meantime you can work around this by (in this case) run curl in silent mode or simply redirect stderr output to /dev/null:

curl -s --fail http://localhost || exit 1

or

curl --fail http://localhost 2>/dev/null || exit 1

Should unblock you for now.

like image 60
Mats Lannér Avatar answered Oct 23 '22 22:10

Mats Lannér