Score:0

Can't `ssh` and the `docker exec` in a single command

br flag

I want to ssh into a remote server that runs a docker engine and then docker exec a bash in my-nice-container, in interactive mode. I want to do all in one shot.

I'm doing this from my local computer:

ssh my-site-with-a-docker-engine.example.com docker exec -it my-nice-container bash

I get this error: "the input device is not a TTY"

Question: How can I force the ssh to notify the other side that we are really an interactive terminal?

Note 1:

If I do this command "splitted", it works:

  1. I first ssh,
  2. I then from inside the ssh I type-in the docker exec.

Note 2:

Non-interactive commands work well. For example this works:

ssh [email protected] docker ps -a
Score:0
br flag

Found. It was -t. A first look at the man page https://linux.die.net/man/1/ssh and searching for the words "terminal" and "interactive" did not resolve, this is why I asked.

Then I found that "-t Force pseudo-tty allocation."

This is checked to work:

ssh -t my-site-with-a-docker-engine.example.com docker exec -it my-nice-container bash
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.