Docker image suggestion: Add healthcheck

The idea is:

Add a healthcheck to the n8n docker images by default utilizing n8n’s /healthz status endpoint (which must be enabled for this to work - since it is not enabled by default, that may be a point of contention here? Or maybe it’s not a big deal.)

My use case:

To allow for out of the box Docker health monitoring of n8n containers. With it enabled, docker can perform it’s own management steps if a container becomes unhealthy, the user can see that it’s health in docker ps output, etc.

I think it would be beneficial to add this because:

It may help people catch configuration mishaps that only show up during runtime, or resource issues/etc that cause the health endpoint to fail.

Any resources to support this?

Are you willing to work on this?

Along with setting QUEUE_HEALTH_CHECK_ACTIVE=true to enable the /healthz endpoint, I’m using the following command that works well for the healthcheck command in my docker-compose setup:

    healthcheck:
      test: ["CMD", "sh", "-c", "(wget -q -T 5 -O - http://localhost:5678/healthz 2>/dev/null | grep -qF '{\"status\":\"ok\"}') || exit 1"]

This should be easily adaptable to the format required for use in the image/Dockerfile, perhaps the following:

HEALTHCHECK CMD (wget -q -T 5 -O - http://localhost:5678/healthz 2>/dev/null | grep -qF '{"status":"ok"}') || exit 1