Last reviewed: July 5, 2026. Applies to: docker exec usage from Jenkins and CI environments without interactive TTY allocation. Currentness note: Commands and screenshots are retained for the documented environment. Before production use, verify package names, image tags, cloud-provider UI labels, and plugin versions against your current platform.
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 ).
