5

I need to log in to a bash console within a docker container, which runs in a remote host.

The following commands work:

(local)$ ssh -i myKey user@remoteHost
(remote)$ docker exec -it myContainer /bin/bash

Note that I use passwordless authentication with SSH. My scenario is a bit more involved, including a script to get into a single command (which would actually also figure out docker container ID), this is enough to show the problem. When I try to run in a single command, I get the following error:

(local)$  ssh -i myKey user@remoteHost "docker exec -it myContainer /bin/bash"
cannot enable tty mode on non tty input

How can I run this SSH and get past the "cannot enable tty" error?

2 Answers 2

9

Use the -t option (twice) with ssh:

ssh -tt -i myKey user@remoteHost docker exec -it myContainer /bin/bash
Sign up to request clarification or add additional context in comments.

Comments

1

you can use the command (from your pc) docker-machine with this you are able to connect to the docker server (if the api are exposed) an manage the docker like your local environment (docker ps, docker run etc etc) documentation:

https://docs.docker.com/machine/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.