I run docker exec -it in jenkins jobs and get error 'cannot enable tty mode for input without tty. There is no return to the docker exec command. My account was as follows:
jenkins shell -> ssh user@<testdriver> -> ssh root@<sut> -> su - <user> -> docker exec -it <container>
I made changes to using the -T flag in the original ssh from jenkins. "-T - Disable pseudo-terminal distribution." And use the -i flag with docker exec instead of -it. "-i - interactive. -t - highlight pseudo-tty.". This seems to have solved my problem.
jenkins shell -> ssh -T user@<testdriver> -> ssh root@<sut> -> su - <user> -> docker exec -i <container>
The behavior type corresponds to this docker exec tty error: https://github.com/docker/docker/issues/8755 . The workaround in this discussion of docker errors involves using this:
docker exec -it <CONTAINER> script -qc <COMMAND>
Using this workaround did not solve my problem. It is interesting. Try using them with different flags and with different ssh calls you can see "not tty" even when using -t with docker exec:
$ docker exec -it <CONTAINER> script -qc 'tty' /dev/pts/0 $ docker exec -it <CONTAINER> 'tty' not a tty $ docker exec -it <CONTAINER> bash -c 'tty' not a tty
gaoithe Jul 27 '16 at 15:46 2016-07-27 15:46
source share