2

I have a bash script in my docker container that use netcat to receive a datagram from a raspberry with this command:

msg_port=60001
nc -k -u -l -p $msg_port >> /data/hydro/info.txt &

Now, i have tested this script on my computer (outside of container) and it works.

But when i run it with a container, that use netcat-traditional, in the first run it works perfectly. But if i restart the script in the raspberry without restarting the container, it seems to no longer receive data, even if it remains listening.

I think the problem is that the netcat command is unable to accept new connections, althought -k option should be used to avoid this problem. I repeat that, outside of the container, everything works

4
  • What are the exact version of nc on the host machine where the script has been tested and in the container? Commented Dec 26, 2024 at 23:09
  • @OrtomalaLokni version of nc on the host machine is 1.226-1 (netcat-OpenBsd) and version in the container is 1.10-48 (netcat-traditional) Commented Dec 27, 2024 at 11:33
  • You should try to use nc 1.226-1 (netcat-OpenBsd) in the container. Commented Dec 27, 2024 at 16:30
  • I had already tried, but ran into this problem package netcat has no installation candidate and had to switch to netcat-traditional Commented Dec 27, 2024 at 20:36

1 Answer 1

0

I solved the problem. At the beginning I had written apt install netcat in the dockerfile, so I had come across this problem package netcat has no installation whose solution was to specify the netcat package. due to my forgetfulness, instead of writing apt install netcat-openbsd I had written apt install netcat-traditional, thinking that that package was installed on the host (where the command worked)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.