Reputation: 1516
I'm trying to import SQL data to a docker container. Using git bash / mintty:
> docker exec -it 79c5c16acca0 mysql -uusername -ppassword dbname
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'
> winpty docker exec -it 79c5c16acca0 mysql -uusername -ppassword dbname
stdin is not a tty
I have also tried Powershell:
> Get-Content powo.sql | docker exec -it 79c5c16acca0 mysql -uusername -ppassword dbname
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'
FWIW, running bash
in the container works fine:
> docker exec -it 79c5c16acca0 bash
root@79c5c16acca0:/#
Upvotes: 3
Views: 4368
Reputation: 3274
This will work if you remove -t
.
$ docker run --rm --name example alpine sleep 100
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
49968909e3e4 alpine "sleep 100" 8 seconds ago Up 7 seconds example
$ echo "hi" | docker exec -it example cat
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'
$ echo "hi" | docker exec -i example cat
hi
This is true for bash
, ps
, and Git bash.
This answer is the best reference I can find on what -i
and -t
do (in language that I can understand).
From that, my guess is that you can't use -t
when piping in content as -t
implies the input is from a terminal device, but in this case the input is the pipe (which itself is from the terminal device).
Upvotes: 5