【问题标题】:Docker and git bash: the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'Docker 和 git bash:输入设备不是 TTY。如果您使用的是 mintty,请尝试在命令前加上“winpty”
【发布时间】:2019-01-17 20:26:04
【问题描述】:

我尝试在 git bash shell 中运行以下 Docker 命令。

docker exec -it service /bin/bash

但我收到以下错误

the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'

当我尝试使用winpty 运行命令时,如下所示

winpty docker exec -it service /bin/bash

git bash shell 只是提示输入下一个命令,但会在屏幕上渲染文本时搞砸了。如何在 git bash 的 Docker 容器上正确附加交互式 shell?

我可以在 Docker 快速启动终端中运行该命令,但问题是终端输出历史记录非常有限(打印新输出时旧输出丢失)。或者,如何在 Docker 快速入门终端上将输出历史大小扩展到无限滚动?

【问题讨论】:

标签: bash git docker mingw git-bash


【解决方案1】:

尝试使用:

winpty -Xallow-non-tty docker exec -it service /bin/bash

它对我有用。

【讨论】:

  • Error: unrecognized option: '-Xallow-non-tty'
【解决方案2】:

另一种选择(如果使用带有 Windows 10 的 Docker)。

(1) 如果尚未安装 Git:请安装它。

(2) 从 Windows 10 搜索(即左下角:“在此处输入搜索”),输入“Git”

(3) 点击“Git CMD (Deprecated) App”

(4) 使用被调用的外壳。似乎支持“-it”开关...

例如,

 docker exec -it db2 /bin/bash

【讨论】:

    猜你喜欢
    • 2018-07-15
    • 2020-07-02
    • 2017-04-02
    • 2021-12-16
    • 2018-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多