4

When running below command in command line(terminal) this gets executed fine:

$sudo docker exec -it 5570dc09b58 bash

But same results with :

FATA[0000] cannot enable tty mode on non tty input

Error when running in a shell script file.

Priya Dharshini
  • 763
  • 1
  • 6
  • 6

3 Answers3

1

Scripts may be forced to run in interactive mode with the -i option or with a #!/bin/bash -i header.

So adding shebang to the script with -i option should work:

#!/bin/bash -i

docker exec -it ed3d9e46b8ee date

Run the script as usual:

chmod +x run.sh
sudo ./run.sh 

Output:

Thu Apr  2 14:06:00 UTC 2015
Vor
  • 33,215
  • 43
  • 135
  • 193
1

You are not running docker in a terminal, so you should remove -t from -it:

sudo docker exec -i 5570dc09b58 bash

See a more detailed answer here.

Community
  • 1
  • 1
Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
  • 1
    This is the correct answer. I was using `-it` in jenkins `Execute Shell` but met this error. After I remove the `-t`, it works, thanks. – mainframer Jan 03 '16 at 03:46
0

There are few images which do not support the interactive shell/bash. Example - Docker image mockserver/mockserver Docker Set Up

Ravi Wadje
  • 1,145
  • 1
  • 10
  • 15