“the input device is not a TTY” fix when running Docker in Azure DevOps

Attempting to run Docker in Azure DevOps and getting error “the input device is not a TTY”? In in this blog post, I will show you a simple fix used to resolve the issue I was having.

When attempting to use Docker inside a Bash@3 task; I kept getting the error:-

========================= Starting Command Output ===========================
/bin/bash /home/vsts/work/_temp/c357347e-c014-46e2-8193-13d47a7220d0.sh
the input device is not a TTY

##[error]Bash exited with code '1'.
Finishing: Bash

The Docker command I was running was simpler to the below:-

docker run -it -e variable1="variable1" -e varable2="variable2" --rm -v $(pwd):/share chef/inspec:latest $@;

Notice in this Docker command “-it”? What does it mean? Lets review docs.docker.com

For interactive processes (like a shell), you must use -i -t together in order to allocate a tty for the container process. -i -t is often written -it

docs.docker.com

When running docker in Azure DevOps I didn’t want to run an interactive session (had tested this locally and worked OK). Removing “-it” from my Docker command resolved the issue and allowed Docker to run successfully.

docker run -e variable1="variable1" -e varable2="variable2" --rm -v $(pwd):/share chef/inspec:latest $@;

A quick blog post to assist you in resolving the issue “the input device is not a TTY” when running Docker in Azure DevOps.

1 thought on ““the input device is not a TTY” fix when running Docker in Azure DevOps”

Leave a comment

Discover more from Thomas Thornton Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading