I am new with Consul/Registrator and Docker. I am confused about using the Consul healthcheck in Docker environment. It is described in the following link, within the section Docker + Interval: https://www.consul.io/docs/agent/checks.html
Here is the example of Consul healthcheck definition described in the link:
{
"check": {
"id": "mem-util",
"name": "Memory utilization",
"docker_container_id": "f972c95ebf0e",
"shell": "/bin/bash",
"args": ["/usr/local/bin/check_mem.py"],
"interval": "10s"
}
}
Is the healthcheck script within the docker image or outside of it (in the example: check_mem.py)? Should we know the ID of the container and manually insert in the field: docker_container_id? (this would be not very efficient way)
I have been googling around and the only answer that I can find is at the end of the following discussion: https://github.com/hashicorp/consul/issues/3182
But this code is some 'workaround' - it uses the docker 'primal' healthcheck and the registrator variable - ENV SERVICE_CHECK_SCRIPT. It does not use consul healthcheck script.
Can anybody help me with understanding how consul healthcheck works in docker environment.