Any ideas why nc is not showing anything when ran on a busybox based container image? The problem appears when trying to connect to port on

/app # nc -v 12345
/app # nc -v localhost 12345
/app # nc
BusyBox v1.35.0 (2022-08-01 15:14:44 UTC) multi-call binary.

Usage: nc [OPTIONS] HOST PORT  - connect
nc [OPTIONS] -l -p PORT [HOST] [PORT]  - listen

What I would expect is to see if nc has connected or not. On normal Ubuntu the command outputs successful or unsuccessful connections like below. On busybox I don't know what happened because nothing is outputted. enter image description here

  • What is running on port 12345? What sort of output do you expect to see?
    – larsks
    Sep 5, 2022 at 15:57
  • 2
    Many commands in busybox are a pale imitation of the full command/tool they mimic. So I'm not quite sure what you expected to see.
    – HBruijn
    Sep 5, 2022 at 15:58
  • @larsks I added explanation what I expect: basically I want to simply know if it connected or not?
    – nosalan
    Sep 6, 2022 at 8:26
  • It looks to me like busybox nc returns an error code if it fails to connect. So nc localhost 12345 || echo FAILED is maybe what you want.
    – larsks
    Sep 6, 2022 at 11:57

1 Answer 1


Most Linux/Unix programs don't saying anything unless some error occurred. This is because same programs are often also used for scripting. See https://en.wikipedia.org/wiki/Unix_philosophy Additionally BusyBox by design is quite and tries to avoid large texts.

But you can check for error code that the program returned with $? command.

$ busybox httpd -p 8080
$ busybox nc 8081
nc: can't connect to remote host ( Connection refused
$ echo $?
$ busybox nc 8080
$ echo $?

Here I started httpd on port 8080. Then executed the nc but it failed with error code 1. Again started nc on 8080 port and it was successful and didn't tell anything. But I interrupted it so the exit code was 130:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .