Troubleshooting
exec
- Problem:
In a Jenkinsfile, when running a
docker exec -itcommand, it returns the following error and fails:the input device is not a TTY
- Cause:
A Jenkinsfile is run in a context which does not provide a TTY, which allows for immediate output from the shell to allow user interaction. By default, Jenkins uses non-TTY shells for the execution of Jenkinsfiles, in which case commands, which require and interactive shell (such as
docker exec -it), fail.- Solution:
Make the
docker execcommand non-interactive by removing the-itoptions:$ docker exec CONTAINER_NAME COMMAND [ARGUMENTS...]