6
votes

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.

2
Check your active/inactive tasks that are running. When you say you tried the healthcheck yourself, does that mean you docker exec into a running task, or did you launch the image yourself? 16MiB is a very low hard memory limit. This could be causing ECS to continually exit and relaunch the container, which means health checks would never even have a chance to return successfully.louahola
Did you come up with any solution.Tara Prasad Gurung

2 Answers

6
votes

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|

0
votes

Remove the double quotes around the command, should work