You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker内Deployer启动远程SSH会话遇input device is not a TTY错误

问题解决:Deployer脚本开启SSH会话时"the input device is not a TTY"错误

核心问题分析

你脚本中使用了ssh -T命令,其中-T参数的作用是强制禁用伪终端请求,这和你要开启交互式SSH会话的需求完全冲突。而手动执行ssh {remoteUser}@{hostname}时没有该参数,所以能正常获取TTY。

解决方案

修改脚本,移除-T参数,确保runLocally的tty选项正确启用:

task('remotessh', function () {
    $host = currentHost();

    $hostname = $host->getHostname();
    $remoteUser = $host->get('remote_user');

    if (!$remoteUser) {
        throw new \RuntimeException("Remote user not set for host.");
    }

    // 移除-T参数,允许SSH请求伪终端
    $sshCommand = "ssh $remoteUser@$hostname";
    // 若仍有问题,可替换为-tt强制分配TTY:$sshCommand = "ssh -tt $remoteUser@$hostname";
    runLocally($sshCommand, ['tty' => true]);
});

补充说明

  • 若去掉-T后依然报错,可改用-tt参数:该参数会强制SSH分配伪终端,适用于部分Docker环境下TTY检测异常的场景。
  • 修改后在Docker终端执行dep remotessh(根据你的Deployer命令调整),即可正常进入远程SSH会话。

内容的提问来源于stack exchange,提问作者warm__tape

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 20:48:25