0

I'm new to Docker.

I have a simple DockerFile:

FROM ubuntu:12.04

CMD echo "Test"

I built the image using the docker build command (docker build -t dt_test .). All that I want to do is run the docker image interactively on Git bash. The path in git has been set up to include the docker toolbox.

When I run the interactive docker run command: "docker run -it dt_test" it gives me an ERROR:

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

So I've tried prefixing the run command with winpty, and it executes the command but doesn't show me the interactive shell. When I type something, I cant see any of the commands that I'm typing into the terminal. I have to then type "reset" and then it sets the terminal back to normal. So I guess the winpty command isn't working

Questions:

  1. Is there something wrong with the "winpty docker run -it dt_test" command and why doesn't it work?
  2. How can I fix this issue to make my file run interactively?

FYI: When I run the docker file non interactively it seems to work fine. shows "Test" in the terminal according to the Dockerfile.

LemonSnippet
  • 105
  • 3
  • 12
  • Can you try `docker run -i dt_test`? (without the `-t`) – Robert Seaman Apr 02 '18 at 19:03
  • As another solution, you can use [Cygwin](https://cygwin.com/install.html) instead of `git-bash`. `git-bash` is a limited toolset and is less suitable for a wide range of *nix-like utilities. You can also take advantage of Docker for Window's PowerShell support to run similar commands without any trouble. – Mike Hill Apr 02 '18 at 19:09
  • @RobertSeaman The command without the -t runs, but it doesn't give me an interactive shell. It just runs the dockerfile as is (same as docker run dt_test). – LemonSnippet Apr 02 '18 at 19:54
  • I don't know what your ENTRYPOINT is, but why don't you run it with `--entrypoint bash`? – Robert Seaman Apr 02 '18 at 19:55

1 Answers1

1

Looks to be the same as the input device is not a TTY.

Try without the -t:

docker run -i dt_test

And to run it with a different entrypoint (like bash):

docker run -i --entrypoint bash dt_test
Robert Seaman
  • 2,432
  • 15
  • 18
  • This worked! Thank you!! Not sure how --entrypoint bash affected this, but I was using the default entry point /bin/sh -c – LemonSnippet Apr 02 '18 at 20:16