32

Jenkins: the input device is not a TTY

 4 years ago
source link: https://www.tuicool.com/articles/EbuaUnB
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

在使用jenkins执行docker容器内命令时,jenkins会提示

docker exec -it test_container bash build.sh

the input device is not a TTY

在Stack Overflow上查找错误内容,解决方法如下:

去掉docker的-it或者把-it改成-i,即

docker exec -i test_container bash build.sh

这样就可以解决。

原因解析:

docker exec的参数t是指的Allocate a pseudo-TTY,jenkins在执行job时并不是在TTY终端中执行,所以-t的参数会报错。

PS:

pseudo-TTY:

Linux 中,TTY也许是跟终端有关系的最为混乱的术语。TTY是TeleTYpe的一个老缩写。Teletypes,或者teletypewriters,原来指的是 电传打字机 ,是通过串行线用打印机键盘通过阅读和发送信息的东西,和古老的 电报机 区别并不是很大。之后,当计算机只能以 批处理 方式运行时(当时穿孔卡片 阅读器 是唯一一种使程序载入运行的方式),电传打字机成为唯一能够被使用的“实时”输入/ 输出设备 。最终,电传打字机被键盘和显示器终端所取代,但在终端或TTY接插的地方,操作系统仍然需要一个程序来监视 串行端口 。一个getty“Get TTY”的处理过程是:一个程序监视物理的TTY/终端接口。对一个 虚拟网络 服务器( VNC )来说,一个伪装的TTY(Pseudo-TTY,即假冒的TTY,也叫做“PTY”)是等价的终端。当你运行一个 xterm ( 终端仿真 程序)或GNOME终端程序时,PTY对虚拟的用户或者如xterm一样的 伪终端 来说,就像是一个TTY在运行。“Pseudo”的意思是“duplicating in a fake way”(用伪造的方法复制),它相比“virtual”或“emulated”更能真实的说明问题。而在的计算中,它却处于被放弃的阶段。

tty也是一个Unix命令,用来给出当前终端设备的名称。

终端是一种字符型设备,它有多种类型,通常使用tty来简称各种类型的终端设备。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK