Dockerfile

AWS ECS Task

"Health check parameters that are specified in a container definition override any Docker health checks that exist in the container image (such as those specified in a parent image or from the image's Dockerfile)."  as stated at:

https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_HealthCheck.html


Therefore it must not be configured (not in terraform nor in console), or set to null, i you wish the Dockerfile HEALTHCHECK entry to be honored. 

HEALTHCHECK

If command needs a shell then use CMD-SHELL, otherwise just CMD.

The options that can appear before CMD are:

    --interval=DURATION (default: 30s)

    --timeout=DURATION (default: 30s)

    --start-period=DURATION (default: 0s)

    --start-interval=DURATION (default: 5s)

    --retries=N (default: 3)

Example that assumes cURL is available in the docker image:

HEALTHCHECK --interval=32s --timeout=16s --start-period=96s --retries=4 \

  CMD curl -s --fail --request POST --header "Content-Type: text/xml;charset=UTF-8" --data "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ser='http://service.cou.edu'><soapenv:Header/><soapenv:Body><ser:healthCheckTask/></soapenv:Body></soapenv:Envelope>" http://localhost:8080/context/services/v2/MyService || exit 1