I am executing commands against a docker container using socat and I want to get the exit code of the code executed in the container.
This is what I've tried:
$ docker run --rm -itd --name test123 ubuntu
$ echo "ls" | socat EXEC:"docker attach test123",pty - &> /dev/null
$ echo $?
0
$ echo "foobar" | socat EXEC:"docker attach test123",pty - &> /dev/null
$ echo $?
0
as you can see this is not working properly because the exit code for the foobar
command should obviously be non-zero.
$ socat -V
socat version 1.8.0.1 on
running on Darwin version
Asked by Foo
(242 rep)
Dec 3, 2024, 07:02 PM
Last activity: Dec 5, 2024, 08:36 PM
Last activity: Dec 5, 2024, 08:36 PM