ERROR: Docker – The input device is not a TTY

In this post I will try to help you fix error like “The input device is not a TTY”.

Problem and solution

This error will occur if you are trying to run docker container using -it option, which means that you want to run docker container for interactive processes (like a shell).

First time I have encountered this problem when I was trying to run docker container from Jenkins pipeline.

Conclusion

In case when you would like to run docker container from command line and that use shell/bash you need to use -it option like below:

docker run -it my_docker_image

In case when you are running docker container through remote process you have to remove -it options:

docker run my_docker_image

Execute command in docker container

The same approach you must apply when you would like to execute command in docker container. Let’s image situation when you have run docker-compose.yml file with set of services and you would like to execute command inside container. Than you must use -T option:

docker-compose exec -T <container_name> sh -c "/scripts/run.sh"

If you enjoyed this post please add the comment below or share this post on your Facebook, Twitter, LinkedIn or another social media webpage.
Thanks in advanced!

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments