When Running Docker via SSH and Encountering "the input device is not a TTY" Error, Add the -t Option

Docker Linux
2022-06-12 11:55 (2 years ago) ytyng

When you want to start an interactive program using TTY on a remote server with the following command:

docker run --rm -it <image-name> /bin/sh

you can do so without any issues by first executing:

ssh <user>@<remote-server>

and then, once the remote shell is initiated, running:

docker run --rm -it <image-name> /bin/sh

This allows you to use the TTY-based program on Docker without any problems.

However, if you attempt to run both SSH and the Docker run command in one go from your local machine (e.g., Mac), like this:

ssh <user>@<remote-server> -- docker run --rm -it <image-name> /bin/sh

you will encounter an error:

ssh docker run the input device is not a TTY

In such cases, you can resolve the issue by adding the -t option to the ssh command.

ssh -t <user>@<remote-server> -- docker run --rm -it <image-name> /bin/sh

And that’s it!

Currently unrated

Comments

Archive

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011