I am running the following command from my Jenkinsfile
. However, I get the error \"The input device is not a TTY\".
docker run -v $PWD:
winpty works as long as you don't specify volumes to be mounted such as ".:/mountpoint" or "${pwd}:/mountpoint"
The best workaround I have found is to use the git-bash plugin inside Visual Code Studio and use the terminal to start and stop containers or docker-compose.
For those who struggle with this error and git bash on Windows, just use PowerShell where -it
works perfectly.
It's not exactly what you are asking, but:
The -T key would help people who are using docker-compose exec!
docker-compose -f /srv/backend_bigdata/local.yml exec -T postgres backup
I believe you need to be in a TTY for docker to be able to allocate a TTY (the -t
option). Jenkins executes its jobs not in a TTY.
Having said that, the script you are running within Jenkins you may also want to run locally. In that case it can be really convenient to have a TTY allocated so you can send signals like ctrl+c when running it locally.
To fix this make your script optionally use the -t
option, like so:
test -t 1 && USE_TTY="-t"
docker run ${USE_TTY} ...
if using windows, try with cmd , for me it works. check if docker is started.