the input device is not a TTY 🐳 Docker

the input device is not a TTY

docker run/exec was called with -t (allocate a terminal) in a context with no terminal — CI, cron, a pipe or a script.

Seen on: Docker

Meaning

-t needs an interactive terminal. In CI, cron jobs, or when piping input (docker exec -it db mysql < dump.sql) there is none. Drop -t (keep -i if you pipe stdin).

Common causes

  • -it used in CI/cron/scripts
  • Piping input into docker exec -it
  • Git Bash/mintty on Windows without winpty

⚡ Quick fix

  1. Use -i without -t when piping
  2. Remove -it in non-interactive scripts
  3. On Git Bash prefix with winpty

Detailed fix by platform

Docker

  1. docker exec -i db mysql -uroot -p"$PW" app < dump.sql

Docker Compose

  1. docker compose exec -T db psql -U postgres < dump.sql # -T disables the TTY

How to diagnose

  1. Context — Interactive terminal or script?
  2. Stdin — Is input piped?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.