Fix: the input device is not a TTY – Docker

docker

Whenever I try to execute a command inside the Docker container with Jenkins, the following error appears:

the input device is not a TTY

Solution:

Instead of using the following in your Jenkinsfile or Jenkins Pipeline Library:

docker exec -it

Use the following instead:

docker exec --tty

The --tty tells docker to configure the tty, which won’t work if you don’t have a tty and try to attach to the container ( that is the default behaviour when you don’t detach -d the container ).

By Dennis Otugo

Dennis Otugo is a Consultant at Bantrain, and loves all things DevOps. In his role, he enables enterprise customers in their digital transformation journey and helps architect cloud-native solutions