docker error : the input device is not a TTY. If y

2019-02-09 00:49发布

问题:

After i run this
$ docker run --rm -v "/c/users/vipul rao/documents/github/wappalyzer:/opt/wappalyzer" -it wappalyzer/dev

I am getting the following error the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty' What should i use here i am running on windows 8 in MINGW64.

回答1:

As suggested by the error message you obtain, you should try to use winpty (which is installed by default with Git-Bash) and thus run:

winpty docker run --rm -v "/c/users/vipul rao/documents/github/wappalyzer:/opt/wappalyzer" -it wappalyzer/dev

If this works, you may want to set a Bash alias to avoid manually prepending winpty all the time:

echo "alias docker='winpty docker'" >> ~/.bashrc

or

echo "alias docker='winpty docker'" >> ~/.bash_profile


回答2:

Remove -it from the command. If you want to keep it interactive then keep -i



回答3:

This problem occurs when running with -it option using bash terminal on windows. You can use Powershell to resolve this issue.



回答4:

Did you start "Docker Quickstart Terminal"? I was trying to run

$ docker run -i -t redcricket/react-tutorial:latest /bin/bash

on windows from a Cygwin bash shell and got the same error:

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

Then I remembered that when I installed docker on my windows 10 system something called "Docker Quickstart Terminal" got installed. You need to start that first from that dumb windows 'Type here to search' thing on the task bar:

That launches this …

… you can run your docker commands there without getting that error or running winpty.



回答5:

It may be that you're not running your commands within the Docker terminal. If you don't, you may not be properly connected to the Docker daemon and won't be able to interact correctly.

Make sure you're running commands in the actual Docker Terminal.



回答6:

you can try with Cmder tool it will work. Its not working with Gitbash



回答7:

In addition to above mentioned solutions. In case you are getting this error for docker attach

example: docker attach alpine1

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

Solution: Adding winpty before docker command i.e. winpty docker attach should work.

example: winpty docker attach alpine1

Note: I was getting this error while using base on windows and this solution worked for me.