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?
dcv-gateway:
image: dcv-gateway:1.0.0-stage
hostname: "dcv-gateway-{{.Task.ID}}"
networks:
- public-stage
- dcv-network-stage
secrets:
- source: tls_cert
target: tls_cert
uid: "999"
gid: "999"
mode: 0600
- source: tls_cert_pkcs8_key
target: tls_cert_key
uid: "999"
gid: "999"
mode: 0600
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--spider", "--tries=1", "http://localhost:8989/"]
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
deploy:
mode: replicated
replicas: 3
placement:
max_replicas_per_node: 1
update_config:
parallelism: 1
delay: 10s
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 3
window: 120s
resources:
limits:
cpus: '1.0'
memory: 1024M
The dcv-gateway
image is build using an Ubuntu image and installing dcv gateway in it, then running dcv gateway as the entry point. It is a pretty basic Dockerfile.
Could you please verify that the DCV Gateway container is correctly configured to listen on the specified address and port (0.0.0.0:8989). You can inspect the container's configuration to confirm this.
Well I am using the health check from within the container, so I do not need to forward the port to the outside. I have updated the post with the docker-compose config.