moby: "cannot enable tty mode on non tty input" in Cygwin in Windows
When attempting to run docker in Cygwin(Babun) in Windows if the command uses the -t flag I receive the message:
>>docker run -ti ubuntu bash
time="2015-04-16T22:49:12-07:00" level=fatal msg="cannot enable tty mode on non tty input"
it seems like it isn’t correctly passing the -t option to the underlying ssh call, but I don’t know why that would be seeing as the ssh installed with git seems to have the same arguments as the one installed with Babun.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 3
- Comments: 77 (11 by maintainers)
Using Git for Windows 2.5.0 in mintty:
winpty works, but slows down startup considerably.
@elrac or
docker-machine ssh <machine name>
@endosynth If you are using Cygwin you may well try babun-docker.
Babun is an improved Cygwin.
And babun-docker might be what you need: https://github.com/tiangolo/babun-docker
It’s just a little program that works on top of Docker in the Babun Terminal (via Winpty), but makes the usage of Docker in Windows a lot simpler and closer to what was intended. Without having to SSH, adding and mounting shared volumes in your Virtual Machine, using Winpty directly and other things.
I’m use this command to interactive with my container:
mysqldb = container names It’s works for me
For completeness, you can use winpty to present a TTY-style input to mintty - it’s even in the git for Windows installer. Couple of screenshots below - one for the installer, other showing an interactive docker attach and docker login from mintty, both not using (error case) and using (success case) winpty.

I was having the same issue when I tried to run “docker run -it ubuntu bash” from cygwin. here is what I did to resolve the issue: Aparently, this problem is to do with MinTTY being implemented as pipes instead of something that directly encapsulates a Windows console.
so the work around for this (after digging around some resources which I will reference below) was to install WinPTY. This is a tool that launches a program in a typical Windows console, captures the data, and forwards it to MinTTY seamlessly.
so I followed the guide from this website: https://github.com/rprichard/winpty after understanding that i needed to have the following cygwin packages: -mingw64-x86_64-gcc-g++ -gcc-g++ -make
I decided to re-install the version of my installed cygwin (this is not actually necessary, but I just wanted to start on a clean slate) I decided to have the follwong packages installed with my fress install of cygwin: lynx, wget, curl, rsync -python, python3 -bzip, tar -Bash-completion -vim, vim-common -tmux -git -diffutils -make -gcc-c, gcc-g++ -openssh -ncurses
after installing cygwin, I ran: cd /bin then clone the repo from like thus:
git clone https://github.com/rprichard/winpty.git then cd into the winpty directory and ran: ./configure, make and make install to setup the winpty package.
after that i tested my installtion from the cygein terminal: by entering the command: $ winpty powershell the result was success ! I got windows powershell propmt on cygwin
then i ran the docker exec command $ winpty docker run -it ubuntu bash and it worked !
but now i have some issues with my cygwin installation ! I keep getting " permission denied" error when I tried to run ’ apt-cyg’ install command.
i get a permission denied message also when I tried to start a ‘Dockerized webserver’ using the command: docker run -d -p 80:80 --name webserver nginx from cygwi
@tiangolo thank you very much!
btw, it’s work with docker beta!
Since I’m seeing a lot of other people trying to deal with this issue the easiest workaround I have found has been to ssh into the VM with
boot2docker ssh
then run your docker command. I have found it to be easier than installing a completely different command line program.@apobekiaris Again, Docker Toolbox 1.8.1c includes Git 2.5. Git 2.5 now uses mintty which does not allow for tty input. Because of this you will not be able to use docker in interactive mode with the -t (Allocate a pseudo-tty).
The reason this worked fine in 1.8.1b was due to the inclusion of an older version of Git for windows that used MINGW32. mintty was not used in that version. If you must use the -it parameter, you have a few options - cmd, powershell, or download the github windows app that includes MINGW32.
To all posting - I don’t think this will ever be ‘resolved’ unless mintty ever supports tty input. @avelinos opened a separate bug against Docker Tools 1.8.1c (https://github.com/docker/toolbox/issues/136) but again, this isn’t related to docker but rather the tools that are included.
This isn’t directly related to Cygwin. For example, the issue also appears when docker is called from a
cmd.exe
shell within Emacs. (Emacs 24.5.1 (i686-pc-mingw32)
) But it works just fine in a Cygwin bash shell running inside a windowed top-levelcmd.exe
process.This is an issue when running ‘docker -it’ command (interactive terminal) when attempting to debug a Dockerfile. Yes we can use the host OS instead of the cygwin/Babun tty terminal, but most/all of the docs written for docker assume a Linux prompt/terminal. Is there a $TERM setting which will work correctly?
+1 same on win 7 / cygwin