Skip to content

Instantly share code, notes, and snippets.

@schnell18
Last active September 6, 2025 02:17
Show Gist options
  • Save schnell18/cb94a8d24f4e643187aa95c629338b2e to your computer and use it in GitHub Desktop.
Save schnell18/cb94a8d24f4e643187aa95c629338b2e to your computer and use it in GitHub Desktop.
The nc included in the busybox of Alpine can't be used to do health check reliably as it reports exit code 1 when the server closes immediately (because no data was sent). If you need nc -z to behave “as expected,” replace BusyBox with OpenBSD netcat This gist shows how.
# nc included in the busybox of Alpine can't be used to do health check as it
# reports exit code 1 when the server closes immediately (because no data was sent).
# If you need nc -z to behave “as expected,” replace BusyBox with OpenBSD netcat:
apk add netcat-openbsd # Alpine
apt install netcat-openbsd # Debian/Ubuntu
# Then nc -z localhost 31311 will succeed if the connect() call works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment