docker-nginx-http3 icon indicating copy to clipboard operation
docker-nginx-http3 copied to clipboard

Healthcheck

Open steklopod opened this issue 3 years ago • 1 comments
trafficstars

I have healthcheck in my docker-compose file:

    healthcheck:
      test: ["CMD", "service", "nginx", "status"]

It works in official image, but not works in ranadeeppolavarapu/nginx-http3 :-(

When I do docker ps in terminal I see (unhealthy) status:

629265e849ee   nginx    "nginx -g 'daemon of…"   5 minutes ago    Up 5 minutes (unhealthy)   0.0.0.0:443->443/tcp, :::443->443/tcp       nginx

But it works

steklopod avatar Dec 11 '21 17:12 steklopod

I wasted 1 day for solution. My hack was to change CMD to CMD-SHELL. This solution gives (healthy) status:

      test: ["CMD-SHELL", "if [ -e /var/run/nginx.pid ]; then echo 0; else echo 1; fi"]

Unsuccessfully:

I tried to add in nginx config:

  location  /health {
    default_type text/plain;
    return 200 "healthy\n";
  }

And in docker-comose.yml:

    healthcheck:
      test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://nginx:80/health"]

steklopod avatar Dec 12 '21 13:12 steklopod