Last active
September 6, 2025 02:17
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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