dockerhealth-check

DCV gateway healtcheck not working, connection reset by peer


I am deploying a DCV Gateway docker container in a Swarm cluster. I really need to have a healthcheck working for this container. In the case of DCV gateway, the healthcheck should be extremely easy to setup:

[health-check]
bind-addr = "0.0.0.0"
port = 8989

The problem is that the healtcheck continuosly fail. I tried to call the healtcheck API with curl and wget, and I get the same error:

curl: (56) Recv failure: Connection reset by peer

--2024-02-02 13:36:03--  http://localhost:8989/
Resolving localhost (localhost)... 127.0.0.1, ::1
Connecting to localhost (localhost)|127.0.0.1|:8989... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

What am I doing wrong?


Solution

  • Nice DCV gateway healthcheck is not an http endpoint, but only TCP. This is not specified anywhere in the documentation. Anyway, the healthcheck in this case will be:

      healthcheck:
        test: ["CMD-SHELL", "exec", "6<>", "/dev/tcp/localhost/8989"]
        interval: 5s
        timeout: 5s
        retries: 5
        start_period: 5s