registrator icon indicating copy to clipboard operation
registrator copied to clipboard

Health checks with SERVICE_CHECK_SCRIPT doesn't work

Open kevinimbrechts opened this issue 4 years ago • 1 comments

Hi there,

  • What version of docker are you running? Docker version 18.09.7, build 2d0083d
  • What version of registrator are you running? v7
  • What version of Consul are you running? Consul v1.6.1
  • Did you build a custom version of registrator? If so, what is that image? No
  • What is the exact command you are running registrator with? -internal=true -deregister=on-success consul-tls://consul:8501
  • What is the exact command you are running your container with?
environment:
  - SERVICE_CHECK_SCRIPT=curl --noproxy '*' example.com
  • A log capture of all the docker events before, during, and after the issue.
2020/10/02 14:53:41 [ERR] agent: Check "service:xxxxxxxxxxxxxxxxx" failed to invoke: exec: "curl --noproxy '*' example.com": executable file not found in $PATH

Description of the problem: I want to use health checks with Registrator and Consul, but when I add the env var SERVICE_CHECK_SCRIPT, Consul is unable to register the health check. I have tried to change the command by this one :

environment:
  - SERVICE_CHECK_SCRIPT=/usr/bin/curl --noproxy '*' example.com

But I have this error message :

fork/exec /usr/bin/curl --noproxy '*' example.com: no such file or directory

/usr/bin/curl exists in the Consul container :

ls -lah /usr/bin
-rwxr-xr-x    1 root     root      214.0K Jun  5  2019 curl

kevinimbrechts avatar Oct 02 '20 15:10 kevinimbrechts

It's really sad that a useful project like this is left in an abandoned state. I made a Docker image for my personal use that solves this problem and works in swarm with overlay networks. docker pull lettore/registrator:8.0.1-3.11, where 3.11 is the Alpine version used, it's also multi-arch. Hopes this can be useful.

lettore avatar Sep 23 '21 16:09 lettore