docker错误:输入设备不是TTY.如果您使用mintty,请尝试使用'winpty'为命令添加前缀

Vip*_*Rao 28 git github tty docker

我跑完之后
$ docker run --rm -v "/c/users/vipul rao/documents/github/wappalyzer:/opt/wappalyzer" -it wappalyzer/dev

我收到以下错误the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty' 我应该在这里使用我在MINGW64的Windows 8上运行.

Eri*_*kMD 39

根据您获得的错误消息的建议,您应该尝试使用winpty(默认情况下使用Git-Bash安装),然后运行:

winpty docker run --rm -v "/c/users/vipul rao/documents/github/wappalyzer:/opt/wappalyzer" -it wappalyzer/dev
Run Code Online (Sandbox Code Playgroud)

如果这样做,您可能需要设置Bash别名以避免一直手动前置winpty:

echo "alias docker='winpty docker'" >> ~/.bashrc
Run Code Online (Sandbox Code Playgroud)

要么

echo "alias docker='winpty docker'" >> ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)


yam*_*enk 10

-it在Windows上使用bash终端与选项一起运行时,会发生此问题。您可以使用Powershell解决此问题。


小智 10

当您使用 gitbash 时会出现问题,但是您可以打开 CMD 或 Powershell 并且它可以正常工作

在此输入图像描述


Eme*_*bah 10

这对我有用。我在 Windows 上使用 git bash

winpty docker-compose exec app ls -l
Run Code Online (Sandbox Code Playgroud)

  • winpty docker exec -it docker-postgres-1 bash (2认同)

Har*_*rsh 9

-it从命令中删除。如果你想保持互动,那就保持-i

  • 好的,但这并不能解决问题,只能避免它:) (4认同)

w3o*_*ook 7

如果您使用的是Git Bash,可以尝试这样

winpty docker run -it ubuntu
Run Code Online (Sandbox Code Playgroud)


ces*_*ino 7

不要使用 alias docker="winpty docker". 它解决了您的问题,但会破坏管道。

$ winpty docker run -ti ubuntu
root@e85cff7d1670:/# exit

$ wintpy docker run ubuntu bash HELLO 
HELLO

$ wintpy docker run ubuntu bash HELLO | cat
stdout is not a tty
Run Code Online (Sandbox Code Playgroud)

将其复制到您的 .bashrc。此脚本winpty docker仅在-ti使用时使用。

function docker(){
  for param; do if [[ "$param" == "-ti" ]] || [[ "$param" == "-it" ]]; then 
    winpty docker "$@"; return
  fi; done; 
  command docker "$@"
}
Run Code Online (Sandbox Code Playgroud)

docker run -ti ubuntu变得winpty docker run -ti ubuntu回避error: the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'"

docker run ubuntu echo "what's up" | cat变得command docker run echo "what'up" | cat回避error: stdout is not a tty

该脚本只查看是否有“-it”参数,而不会检查它是否在“docker run”语句中……但它对我的使用很有帮助。


Red*_*ket 5

你启动了“Docker Quickstart Terminal”吗?我试着跑

$ docker run -i -t redcricket/react-tutorial:latest /bin/bash
Run Code Online (Sandbox Code Playgroud)

在来自 Cygwin bash shell 的 Windows 上并得到相同的错误:

the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'
Run Code Online (Sandbox Code Playgroud)

然后我记得当我在 Windows 10 系统上安装 docker 时,安装了一个名为“Docker Quickstart Terminal”的东西。您需要先从任务栏上那个愚蠢的窗口“在此处键入以进行搜索”开始:

在此处输入图片说明

这启动了这个……

在此处输入图片说明

...您可以在那里运行您的 docker 命令而不会出现该错误或运行 winpty。