The service has not started yet, or has stopped
CommonA health check or test runs before the app or database finishes starting, or the process crashed.
Confirm
ss -ltnp | grep ':PORT '
No line: nothing is listening on that port
Fix
- Wait for it properly: curl --retry 10 --retry-delay 2 --retry-connrefused --fail URL.
- If it should be running, read its logs: it may have exited.
curl --fail --retry 10 --retry-delay 2 --retry-connrefused http://localhost:8080/health
Reproduced on curl 8.5.0 and 8.7.1: without --retry-connrefused, --retry does not retry a refused connection.