nc
works fine when i execute it on a VM.
Connection to 10.0.0.10 22 port [tcp/ssh] succeeded!
But when I execute the same command inside my docker container, it gives the below UNKNOWN error/exception.
10.0.0.10: inverse host lookup failed: Unknown host
(UNKNOWN) [10.0.0.10] 22 (ssh) open
Below is the nc
command that I am using:
nc -vz 10.0.0.10 22 -w 4
"Inverse host lookup failed" simply means that nc
wanted to print which host name 10.0.0.10 corresponds to, but couldn't.
UNKNOWN is simply what it then prints as the host name.
This is distinct from "I looked it up, but it doesn't seem to correspond to anything" which is what happens outside the container.
To be perfectly explicit, connecting to the host succeeded, but looking up its name from the IP address failed. This is just an informational warning message, not a hard error; the lookup is entirely optional, anyway, and can be disabled with -n
.
If you really want to avoid this warning and not switch to -n
, you need to set up working DNS inside the container.
simply put -n on both sides of listener and client to remove this error as it will neglect the DNS look up by using it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With