2

I try to run the following Docker command in git bash shell.

docker exec -it service /bin/bash

but I get the following error

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

When I try to run the command with winpty as follows

winpty docker exec -it service /bin/bash

The git bash shell just prompts for the next command, but mess up with rendering the text on the screen. How do I properly attach interactive shell on the Docker container on git bash?

I can run the command in Docker Quickstart Terminal, but the problem is the terminal output history is very limited (old output is lost when new ouput is printed). Alternatively, how do I extend the output history size to unlimited scrolling on the Docker Quickstart Terminal?

Tuomas Toivonen
  • 21,690
  • 47
  • 129
  • 225
  • Does this answer your question? [Error "The input device is not a TTY"](https://stackoverflow.com/questions/43099116/error-the-input-device-is-not-a-tty) – Michael Freidgeim Dec 10 '20 at 17:57

2 Answers2

4

try using:

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

it worked for me.

Hamzawey
  • 397
  • 1
  • 5
  • 12
0

another alternative (if using Docker w/ windows 10).

(1) If Git is not already installed: install it.

(2) from windows 10 search (i.e., lower lefthand corner: "Type here to search"), type in "Git"

(3) click the "Git CMD (Deprecated) App"

(4) use the shell that is invoked. It seems the "-it" switch is supported...

e.g.,

 docker exec -it db2 /bin/bash
sairn
  • 461
  • 3
  • 24
  • 58