docker-nginx-http3
docker-nginx-http3 copied to clipboard
Healthcheck
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
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"]