Healthcheck red, app perfectly fine
What we saw
The container was marked unhealthy and restarted in a loop. Opening the app in the browser worked.
How we found it
Running the healthcheck command inside the container by hand.
Cause
Inside the container localhost resolved to the IPv6 address ::1 first. The server only listened on IPv4.
Fix
127.0.0.1 in the healthcheck instead of localhost.
The rule now
Run checks inside the real container, not on your machine.