socat pty,echo=0 terminal option does not work
2
votes
1
answer
140
views
I'd use
socat
to redirect the STDIN/STDOUT
of the process executing docker run -it ubuntu bash
command to a tcp
socket in listening on port 32000
.
root@eve-ng:~# socat -d -d -d EXEC:'docker run -it ubuntu bash',pty,echo=0 TCP4-LISTEN:32000
From another terminal
root@eve-ng:~# nc -v 127.0.0.1 32000
Connection to 127.0.0.1 32000 port [tcp/*] succeeded!
root@ada2551fd122:/# ls /usr
ls /usr
bin games include lib lib64 libexec local sbin share src
root@ada2551fd122:/#
As you can see, the connection takes place and the command ls /usr
executed within the container. The problem I'm facing to is that ls /usr
like any other command entered is echoed back *twice*. As far as I can tell, the option echo=0
is there to prevent this behavior, however it doesn't seem to work as expected.
What is actually going on ? Thanks.
Asked by CarloC
(385 rep)
Jun 23, 2025, 05:53 AM
Last activity: Jun 23, 2025, 07:20 AM
Last activity: Jun 23, 2025, 07:20 AM