marathon-consul
marathon-consul copied to clipboard
Docker HealthCheck Broken
For healthchecks that specify "COMMAND" protocol in marathon, the healthcheck command is executed inside the docker container. (when using docker conatinerizer). So marathon-consul should map it to a "Docker check" instead of "Script check" in consul. The former executes the command inside the docker container while the later executes it on the host.
We need to add the docker container id in the body when making the request to consul and the shell.
Script Check:
{
"check": {
"id": "mem-util",
"name": "Memory utilization",
"script": "/usr/local/bin/check_mem.py",
"interval": "10s",
"timeout": "1s"
}
}
Docker Check:
{
"check": {
"id": "mem-util",
"name": "Memory utilization",
"docker_container_id": "f972c95ebf0e",
"shell": "/bin/bash",
"script": "/usr/local/bin/check_mem.py",
"interval": "10s"
}
}
I'd love to support Docker Check but I think it's not possible right now. There is no mapping between Marathon Task ID and Docker container ID. Docker images could be run by Mesos Contenerizer and this check will fail so this mapping should be optional or in case Mesos Containerizer use mesos attach/exec