DevOps | Cloud | Analytics | Open Source | Programming





How To Fix - Error The Input Device is Not a TTY in Docker ?



In this post, we will explore How To Fix - Error "The Input Device is Not a TTY" in Docker. Error Log


Error: The Input Device is Not a TTY


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

  There are couple of fixes you could try to fix the error.  

  • If you are getting this error, while running Docker compose, use as below -

docker-compose exec -T

OR 

export COMPOSE\_INTERACTIVE\_NO\_CLI=1

For interactive prompt, you have to omit the "-T" flag. But if you prefer to use stdin/stdout, use the "-T" flag  

  • Are you using "-t" in your Docker command ? The "-t" or "-it" asks docker to configure the tty. And if you don't have tty to attach the container, it will obviously fail.  So avoid "-t" from the docker command.
 

  • Are you using SSH tunnel to run the docker command and getting this error ? Are you using "-t" in the command ?
"-t" is a forced pseudo-terminal allocation. It is used to execute arbitrary screen-based programs on a remote machine. Note that single "-t" set up remote TTY  in case already a local TTY is present. But "-tt" will do that without any precondition. So use "-tt" instead.


$ ssh -tt [email protected] -p 2222 "docker run -ti ubuntu bash HELLO "

 

  • If you are using vagrant, set up as RequestTTY in config. It specifies whether to request a pseudo-tty for the session.
~/.ssh/config:


Host vagrant
    <YOUR OTHER CONFIGS>
    RequestTTY force

And Run as


ssh vagrant 'docker run -ti ubuntu bash HELLO'

 

  • If you are using winpty (installed along with Git-Bash) docker in Git-Bash, use a winpty

winpty docker run -it ubuntu

OR you could also use alias , but be aware that it might break pipes


echo "alias docker='winpty docker'" >> ~/.bashrc

echo "alias docker='winpty docker'" >> ~/.bash\_profile

 

  • If you are on windows, switch from git-bash. And use power-shell or cmd prompt on Windows.
 

  • For MobaXterm, whatever shell option that you are using, instead of that shell option use, cmd or powershell
 

  • If you are using WSL, see what docker is used - from Windows or from WSL.

which docker

If you are using WSL, install Docker inside WSL on the linux box (Don't use Docker installed from windows 'Program Files'). And remove alias, if any, on the windows docker from WSL.   Hope the above helps to fix the error.   Other Interesting Reads - ·        How to Send Large Messages in Kafka ? ·        Fix Spark Error – “org.apache.spark.SparkException: Failed to get broadcast_0_piece0 of broadcast_0” ·        How to Handle Bad or Corrupt records in Apache Spark ? ·        How to use Broadcast Variable in Spark ? ·        How to log an error in Python ? ·        How to Code Custom Exception Handling in Python ? ·        How to Handle Errors and Exceptions in Python ? ·        How To Fix – “Ssl: Certificate_Verify_Failed” Error in Python ? ·        How to Send Large Messages in Kafka ? ·        Fix Spark Error – “org.apache.spark.SparkException: Failed to get broadcast_0_piece0 of broadcast_0” ·        How to Handle Bad or Corrupt records in Apache Spark ? ·        How to use Broadcast Variable in Spark ? ·        Best Practices for Dependency Problem in Spark ·        Sample Code – Spark Structured Streaming vs Spark Streaming ·        Sample Code for PySpark Cassandra Application ·        How to Enable UTF-8 in Python ? ·        How to log an error in Python ? ·        Sample Python Code To Read & Write Various File Formats (JSON, XML, CSV, Text) ·        How to Handle Errors and Exceptions in Python ? ·        How to Handle Bad or Corrupt records in Apache Spark ? ·        How To Fix – Partitions Being Revoked and Reassigned issue in Kafka ? ·        What Are The Most Important Metrics to Monitor in Kafka ? ·        How To Connect Local Python to Kafka on AWS EC2 ? ·        How to Send Large Messages in Kafka ? ·        Fix Spark Error – “org.apache.spark.SparkException: Failed to get broadcast_0_piece0 of broadcast_0”    


docker run error the input device is not a tty ,the input device is not a tty linux ,the input device is not a tty bash ,the input device is not a tty docker-compose ,the input device is not a tty ssh ,the input device is not a tty gitlab ci ,the input device is not a tty github actions ,git commit the input device is not a tty ,the input device is not a tty windows ,jenkins the input device is not a tty ,the input device is not a tty ubuntu ,Error: The Input Device is Not a TTY ,the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty' ,